From 7280f571a3368fd2fe61bec49316ba216b6a0a2f Mon Sep 17 00:00:00 2001 From: Samuel De Backer Date: Tue, 13 Feb 2024 22:42:10 +0100 Subject: [PATCH] ObservedBy class attribute --- src/Models/Place.php | 3 +++ src/Providers/ModuleServiceProvider.php | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Models/Place.php b/src/Models/Place.php index 4a08762..f30910f 100644 --- a/src/Models/Place.php +++ b/src/Models/Place.php @@ -2,16 +2,19 @@ namespace TypiCMS\Modules\Places\Models; +use Illuminate\Database\Eloquent\Attributes\ObservedBy; use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Laracasts\Presenter\PresentableTrait; use Spatie\Translatable\HasTranslations; use TypiCMS\Modules\Core\Models\Base; use TypiCMS\Modules\Core\Models\File; +use TypiCMS\Modules\Core\Observers\SlugObserver; use TypiCMS\Modules\Core\Traits\HasFiles; use TypiCMS\Modules\Core\Traits\Historable; use TypiCMS\Modules\Places\Presenters\ModulePresenter; +#[ObservedBy(SlugObserver::class)] class Place extends Base { use HasFiles; diff --git a/src/Providers/ModuleServiceProvider.php b/src/Providers/ModuleServiceProvider.php index a75a9bf..30406d2 100644 --- a/src/Providers/ModuleServiceProvider.php +++ b/src/Providers/ModuleServiceProvider.php @@ -6,7 +6,6 @@ use Illuminate\Support\Facades\View; use Illuminate\Support\ServiceProvider; use TypiCMS\Modules\Core\Facades\TypiCMS; -use TypiCMS\Modules\Core\Observers\SlugObserver; use TypiCMS\Modules\Places\Composers\SidebarViewComposer; use TypiCMS\Modules\Places\Facades\Places; use TypiCMS\Modules\Places\Models\Place; @@ -28,9 +27,6 @@ public function boot(): void AliasLoader::getInstance()->alias('Places', Places::class); - // Observers - Place::observe(new SlugObserver()); - View::composer('core::admin._sidebar', SidebarViewComposer::class); /*