@@ -788,7 +788,7 @@ protected function typeMacAddress(Fluent $column)
788
788
*/
789
789
protected function typeGeometry (Fluent $ column )
790
790
{
791
- return $ this ->formatPostGisType ('geometry ' );
791
+ return $ this ->formatPostGisType ('geometry ' , $ column );
792
792
}
793
793
794
794
/**
@@ -799,7 +799,7 @@ protected function typeGeometry(Fluent $column)
799
799
*/
800
800
protected function typePoint (Fluent $ column )
801
801
{
802
- return $ this ->formatPostGisType ('point ' );
802
+ return $ this ->formatPostGisType ('point ' , $ column );
803
803
}
804
804
805
805
/**
@@ -810,7 +810,7 @@ protected function typePoint(Fluent $column)
810
810
*/
811
811
protected function typeLineString (Fluent $ column )
812
812
{
813
- return $ this ->formatPostGisType ('linestring ' );
813
+ return $ this ->formatPostGisType ('linestring ' , $ column );
814
814
}
815
815
816
816
/**
@@ -821,7 +821,7 @@ protected function typeLineString(Fluent $column)
821
821
*/
822
822
protected function typePolygon (Fluent $ column )
823
823
{
824
- return $ this ->formatPostGisType ('polygon ' );
824
+ return $ this ->formatPostGisType ('polygon ' , $ column );
825
825
}
826
826
827
827
/**
@@ -832,7 +832,7 @@ protected function typePolygon(Fluent $column)
832
832
*/
833
833
protected function typeGeometryCollection (Fluent $ column )
834
834
{
835
- return $ this ->formatPostGisType ('geometrycollection ' );
835
+ return $ this ->formatPostGisType ('geometrycollection ' , $ column );
836
836
}
837
837
838
838
/**
@@ -843,7 +843,7 @@ protected function typeGeometryCollection(Fluent $column)
843
843
*/
844
844
protected function typeMultiPoint (Fluent $ column )
845
845
{
846
- return $ this ->formatPostGisType ('multipoint ' );
846
+ return $ this ->formatPostGisType ('multipoint ' , $ column );
847
847
}
848
848
849
849
/**
@@ -854,7 +854,7 @@ protected function typeMultiPoint(Fluent $column)
854
854
*/
855
855
public function typeMultiLineString (Fluent $ column )
856
856
{
857
- return $ this ->formatPostGisType ('multilinestring ' );
857
+ return $ this ->formatPostGisType ('multilinestring ' , $ column );
858
858
}
859
859
860
860
/**
@@ -865,7 +865,7 @@ public function typeMultiLineString(Fluent $column)
865
865
*/
866
866
protected function typeMultiPolygon (Fluent $ column )
867
867
{
868
- return $ this ->formatPostGisType ('multipolygon ' );
868
+ return $ this ->formatPostGisType ('multipolygon ' , $ column );
869
869
}
870
870
871
871
/**
@@ -876,18 +876,23 @@ protected function typeMultiPolygon(Fluent $column)
876
876
*/
877
877
protected function typeMultiPolygonZ (Fluent $ column )
878
878
{
879
- return $ this ->formatPostGisType ('multipolygonz ' );
879
+ return $ this ->formatPostGisType ('multipolygonz ' , $ column );
880
880
}
881
881
882
882
/**
883
883
* Format the column definition for a PostGIS spatial type.
884
884
*
885
885
* @param string $type
886
+ * @param \Illuminate\Support\Fluent $column
886
887
* @return string
887
888
*/
888
- private function formatPostGisType (string $ type )
889
+ private function formatPostGisType (string $ type, Fluent $ column )
889
890
{
890
- return "geography( $ type, 4326) " ;
891
+ if ($ column ->isGeometry !== null ) {
892
+ return "geometry( $ type " .($ column ->projection === null ? '' : ", $ column ->projection " ).') ' ;
893
+ }
894
+
895
+ return "geography( $ type, " .($ column ->projection ?? '4326 ' ).') ' ;
891
896
}
892
897
893
898
/**
0 commit comments