diff --git a/src/Models/Event.php b/src/Models/Event.php index 79b3094..2bd19fc 100644 --- a/src/Models/Event.php +++ b/src/Models/Event.php @@ -2,6 +2,7 @@ namespace TypiCMS\Modules\Events\Models; +use Illuminate\Database\Eloquent\Attributes\ObservedBy; use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; @@ -10,10 +11,12 @@ 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\Events\Presenters\ModulePresenter; +#[ObservedBy(SlugObserver::class)] class Event extends Base { use HasFiles; diff --git a/src/Providers/ModuleServiceProvider.php b/src/Providers/ModuleServiceProvider.php index 926416a..5369e6b 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\Events\Composers\SidebarViewComposer; use TypiCMS\Modules\Events\Facades\Events; use TypiCMS\Modules\Events\Models\Event; @@ -28,9 +27,6 @@ public function boot(): void AliasLoader::getInstance()->alias('Events', Events::class); - // Observers - Event::observe(new SlugObserver()); - View::composer('core::admin._sidebar', SidebarViewComposer::class); /*