Skip to content

Commit

Permalink
ObservedBy class attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
sdebacker committed Feb 13, 2024
1 parent 9c2e67c commit 602b0b0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/Models/News.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace TypiCMS\Modules\News\Models;

use Illuminate\Database\Eloquent\Attributes\ObservedBy;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Laracasts\Presenter\PresentableTrait;
Expand All @@ -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\News\Presenters\ModulePresenter;

#[ObservedBy(SlugObserver::class)]
class News extends Base implements Feedable
{
use HasFiles;
Expand Down
4 changes: 0 additions & 4 deletions src/Providers/ModuleServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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\News\Composers\SidebarViewComposer;
use TypiCMS\Modules\News\Facades\News as NewsFacade;
use TypiCMS\Modules\News\Models\News;
Expand All @@ -27,9 +26,6 @@ public function boot(): void

AliasLoader::getInstance()->alias('News', NewsFacade::class);

// Observers
News::observe(new SlugObserver());

View::composer('core::admin._sidebar', SidebarViewComposer::class);

/*
Expand Down

0 comments on commit 602b0b0

Please sign in to comment.