From e184bb60db86c956bc595297a8eefb41591fc763 Mon Sep 17 00:00:00 2001 From: jobverplanke Date: Wed, 24 Jul 2024 14:06:59 +0200 Subject: [PATCH] updated readme with custom class for casts --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index 6f1ae8f..49ab972 100644 --- a/README.md +++ b/README.md @@ -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