Skip to content

Commit 0e83984

Browse files
yinxPhilippe Damen
andauthored
moved away from spatialbuilder to scopes to allow projects to define their own builders (#102)
Co-authored-by: Philippe Damen <[email protected]>
1 parent a397289 commit 0e83984

File tree

7 files changed

+301
-377
lines changed

7 files changed

+301
-377
lines changed

README.md

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,13 @@ composer require matanyadaev/laravel-eloquent-spatial
6868
namespace App\Models;
6969

7070
use Illuminate\Database\Eloquent\Model;
71-
use MatanYadaev\EloquentSpatial\SpatialBuilder;
7271
use MatanYadaev\EloquentSpatial\Objects\Point;
7372
use MatanYadaev\EloquentSpatial\Objects\Polygon;
7473
use MatanYadaev\EloquentSpatial\Traits\HasSpatial;
7574

7675
/**
7776
* @property Point $location
7877
* @property Polygon $area
79-
* @method static SpatialBuilder query()
8078
*/
8179
class Place extends Model
8280
{
@@ -150,39 +148,6 @@ echo $vacationCity->area->toJson(); // {"type":"Polygon","coordinates":[[[41.907
150148

151149
For more comprehensive documentation on the API, please refer to the [API](API.md) page.
152150

153-
## Tips for Improving IDE Support
154-
155-
In order to get better IDE support, you can add a `query` method phpDoc annotation to your model:
156-
157-
```php
158-
/**
159-
* @method static SpatialBuilder query()
160-
*/
161-
class Place extends Model
162-
{
163-
// ...
164-
}
165-
```
166-
167-
Or you could override the method:
168-
169-
```php
170-
class Place extends Model
171-
{
172-
public static function query(): SpatialBuilder
173-
{
174-
return parent::query();
175-
}
176-
}
177-
```
178-
179-
Create queries only with the `query()` static method:
180-
181-
```php
182-
Place::query()->whereDistance(...); // This is IDE-friendly
183-
Place::whereDistance(...); // This is not
184-
```
185-
186151
## Extension
187152

188153
You can add new methods to the `Geometry` class through macros.
@@ -219,6 +184,8 @@ Here are some useful commands for development:
219184
* Perform type checking: `composer phpstan`
220185
* Format your code: `composer php-cs-fixer`
221186

187+
Before running tests, make sure to run `docker-compose up` to start the database container.
188+
222189
## Updates and Changes
223190

224191
For details on updates and changes, please refer to our [CHANGELOG](CHANGELOG.md).

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"doctrine/dbal": "^3.5.3",
2121
"friendsofphp/php-cs-fixer": "^3.14.3",
2222
"jubeki/laravel-code-style": "^1.2",
23-
"nunomaduro/larastan": "^1.0|^2.4",
23+
"larastan/larastan": "^1.0|^2.4",
2424
"orchestra/testbench": "^8.0",
2525
"pestphp/pest": "^2.0",
2626
"pestphp/pest-plugin-laravel": "^2.0"

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
includes:
2-
- ./vendor/nunomaduro/larastan/extension.neon
2+
- ./vendor/larastan/larastan/extension.neon
33
parameters:
44
paths:
55
- src

0 commit comments

Comments
 (0)