File tree 1 file changed +34
-2
lines changed 1 file changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -129,16 +129,48 @@ class Location extends Model
129
129
];
130
130
131
131
protected $postgisFields = [
132
- 'location',
133
- 'polygon',
132
+ 'location' => [
133
+ 'geomtype' => 'geography',
134
+ 'srid' => 4326
135
+ ],
136
+ 'location2' => [
137
+ 'geomtype' => 'geography',
138
+ 'srid' => 4326
139
+ ],
140
+ 'location3' => [
141
+ 'geomtype' => 'geometry',
142
+ 'srid' => 27700
143
+ ],
144
+ 'polygon' => [
145
+ 'geomtype' => 'geography',
146
+ 'srid' => 4326
147
+ ],
148
+ 'polygon2' => [
149
+ 'geomtype' => 'geometry',
150
+ 'srid' => 27700
151
+ ]
134
152
];
135
153
136
154
}
137
155
156
+ $linestring = new LineString(
157
+ [
158
+ new Point(0, 0),
159
+ new Point(0, 1),
160
+ new Point(1, 1),
161
+ new Point(1, 0),
162
+ new Point(0, 0)
163
+ ]
164
+ );
165
+
138
166
$location1 = new Location();
139
167
$location1->name = 'Googleplex';
140
168
$location1->address = '1600 Amphitheatre Pkwy Mountain View, CA 94043';
141
169
$location1->location = new Point(37.422009, -122.084047);
170
+ $location1->location2 = new Point(37.422009, -122.084047);
171
+ $location1->location3 = new Point(37.422009, -122.084047);
172
+ $location1->polygon = new Polygon([$linestring]);
173
+ $location1->polygon2 = new Polygon([$linestring]);
142
174
$location1->save();
143
175
144
176
$location2 = Location::first();
You can’t perform that action at this time.
0 commit comments