Skip to content

Commit a335a19

Browse files
authored
Support receiving Expression as a parameter in SpatialBuilder methods (#76)
* Add Expression typehint to support DB::raw * Support DB::raw & geometry everywhere, add tests * Update tests for laravel 10 * Update docs, fix style
1 parent 013a1a7 commit a335a19

File tree

4 files changed

+149
-99
lines changed

4 files changed

+149
-99
lines changed

API.md

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Retrieves the distance between 2 geometry objects. Uses [ST_Distance](https://de
7575

7676
| parameter name | type | default |
7777
|---------------------|---------------------|--------------|
78-
| `$column` | `string` | |
78+
| `$column` | `Geometry \ string` | |
7979
| `$geometryOrColumn` | `Geometry \ string` | |
8080
| `$alias` | `string` | `'distance'` |
8181

@@ -105,7 +105,7 @@ Filters records by distance. Uses [ST_Distance](https://dev.mysql.com/doc/refman
105105

106106
| parameter name | type |
107107
|---------------------|---------------------|
108-
| `$column` | `string` |
108+
| `$column` | `Geometry \ string` |
109109
| `$geometryOrColumn` | `Geometry \ string` |
110110
| `$operator` | `string` |
111111
| `$value` | `int \ float` |
@@ -130,7 +130,7 @@ Orders records by distance. Uses [ST_Distance](https://dev.mysql.com/doc/refman/
130130

131131
| parameter name | type | default |
132132
|---------------------|---------------------|---------|
133-
| `$column` | `string` | |
133+
| `$column` | `Geometry \ string` | |
134134
| `$geometryOrColumn` | `Geometry \ string` | |
135135
| `$direction` | `string` | `'asc'` |
136136

@@ -161,7 +161,7 @@ Retrieves the spherical distance between 2 geometry objects. Uses [ST_Distance_S
161161

162162
| parameter name | type | default |
163163
|---------------------|---------------------|--------------|
164-
| `$column` | `string` | |
164+
| `$column` | `Geometry \ string` | |
165165
| `$geometryOrColumn` | `Geometry \ string` | |
166166
| `$alias` | `string` | `'distance'` |
167167

@@ -191,7 +191,7 @@ Filters records by spherical distance. Uses [ST_Distance_Sphere](https://dev.mys
191191

192192
| parameter name | type |
193193
|---------------------|---------------------|
194-
| `$column` | `string` |
194+
| `$column` | `Geometry \ string` |
195195
| `$geometryOrColumn` | `Geometry \ string` |
196196
| `$operator` | `string` |
197197
| `$value` | `int \ float` |
@@ -216,7 +216,7 @@ Orders records by spherical distance. Uses [ST_Distance_Sphere](https://dev.mysq
216216

217217
| parameter name | type | default |
218218
|---------------------|---------------------|---------|
219-
| `$column` | `string` | |
219+
| `$column` | `Geometry \ string` | |
220220
| `$geometryOrColumn` | `Geometry \ string` | |
221221
| `$direction` | `string` | `'asc'` |
222222

@@ -247,7 +247,7 @@ Filters records by the [ST_Within](https://dev.mysql.com/doc/refman/8.0/en/spati
247247

248248
| parameter name | type |
249249
|---------------------|---------------------|
250-
| `$column` | `string` |
250+
| `$column` | `Geometry \ string` |
251251
| `$geometryOrColumn` | `Geometry \ string` |
252252

253253
<details><summary>Example</summary>
@@ -267,7 +267,7 @@ Filters records by the [ST_Within](https://dev.mysql.com/doc/refman/8.0/en/spati
267267

268268
| parameter name | type |
269269
|---------------------|---------------------|
270-
| `$column` | `string` |
270+
| `$column` | `Geometry \ string` |
271271
| `$geometryOrColumn` | `Geometry \ string` |
272272

273273
<details><summary>Example</summary>
@@ -287,7 +287,7 @@ Filters records by the [ST_Contains](https://dev.mysql.com/doc/refman/8.0/en/spa
287287

288288
| parameter name | type |
289289
|---------------------|---------------------|
290-
| `$column` | `string` |
290+
| `$column` | `Geometry \ string` |
291291
| `$geometryOrColumn` | `Geometry \ string` |
292292

293293
<details><summary>Example</summary>
@@ -307,7 +307,7 @@ Filters records by the [ST_Contains](https://dev.mysql.com/doc/refman/8.0/en/spa
307307

308308
| parameter name | type |
309309
|---------------------|---------------------|
310-
| `$column` | `string` |
310+
| `$column` | `Geometry \ string` |
311311
| `$geometryOrColumn` | `Geometry \ string` |
312312

313313
<details><summary>Example</summary>
@@ -327,7 +327,7 @@ Filters records by the [ST_Touches](https://dev.mysql.com/doc/refman/8.0/en/spat
327327

328328
| parameter name | type |
329329
|---------------------|---------------------|
330-
| `$column` | `string` |
330+
| `$column` | `Geometry \ string` |
331331
| `$geometryOrColumn` | `Geometry \ string` |
332332

333333
<details><summary>Example</summary>
@@ -347,7 +347,7 @@ Filters records by the [ST_Intersects](https://dev.mysql.com/doc/refman/8.0/en/s
347347

348348
| parameter name | type |
349349
|---------------------|---------------------|
350-
| `$column` | `string` |
350+
| `$column` | `Geometry \ string` |
351351
| `$geometryOrColumn` | `Geometry \ string` |
352352

353353
<details><summary>Example</summary>
@@ -367,7 +367,7 @@ Filters records by the [ST_Crosses](https://dev.mysql.com/doc/refman/8.0/en/spat
367367

368368
| parameter name | type |
369369
|---------------------|---------------------|
370-
| `$column` | `string` |
370+
| `$column` | `Geometry \ string` |
371371
| `$geometryOrColumn` | `Geometry \ string` |
372372

373373
<details><summary>Example</summary>
@@ -387,7 +387,7 @@ Filters records by the [ST_Disjoint](https://dev.mysql.com/doc/refman/8.0/en/spa
387387

388388
| parameter name | type |
389389
|---------------------|---------------------|
390-
| `$column` | `string` |
390+
| `$column` | `Geometry \ string` |
391391
| `$geometryOrColumn` | `Geometry \ string` |
392392

393393
<details><summary>Example</summary>
@@ -407,7 +407,7 @@ Filters records by the [ST_Equal](https://dev.mysql.com/doc/refman/8.0/en/spatia
407407

408408
| parameter name | type |
409409
|---------------------|---------------------|
410-
| `$column` | `string` |
410+
| `$column` | `Geometry \ string` |
411411
| `$geometryOrColumn` | `Geometry \ string` |
412412

413413
<details><summary>Example</summary>
@@ -425,11 +425,11 @@ Place::query()
425425

426426
Filters records by the [ST_Srid](https://dev.mysql.com/doc/refman/8.0/en/gis-general-property-functions.html#function_st-srid) function.
427427

428-
| parameter name | type |
429-
|----------------|----------|
430-
| `$column` | `string` |
431-
| `$operator` | `string` |
432-
| `$value` | `int` |
428+
| parameter name | type |
429+
|----------------|---------------------|
430+
| `$column` | `Geometry \ string` |
431+
| `$operator` | `string` |
432+
| `$value` | `int` |
433433

434434
<details><summary>Example</summary>
435435

@@ -441,4 +441,3 @@ Place::query()
441441
->exists(); // true
442442
```
443443
</details>
444-

0 commit comments

Comments
 (0)