Skip to content

Commit

Permalink
updated readme with custom class for casts
Browse files Browse the repository at this point in the history
  • Loading branch information
jobverplanke committed Jul 24, 2024
1 parent 57cffb1 commit e184bb6
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,25 @@ class AppServiceProvider extends ServiceProvider
}
```
Update your model to use the custom geometry class in the `casts()` method
```php
use App\ValueObjects\Point;
use Illuminate\Database\Eloquent\Model;
use MatanYadaev\EloquentSpatial\Traits\HasSpatial;
class Location extends Model
{
use HasSpatial;
protected function casts(): array
{
return [
'coordinates' => Point::class,
];
}
}
```
### Extend Geometry class with macros
Expand Down

0 comments on commit e184bb6

Please sign in to comment.