postCacheService = new PostCacheService(); } /** * Handle the Post "created" event. */ public function saved(Post $post): void { $this->postCacheService->clearAllCacheByModel(); } /** * Handle the Post "updated" event. */ public function updated(Post $post) { $this->postCacheService->clearCache($post); } /** * Очистка кеша при удалении поста. */ public function deleted(Post $post) { $this->postCacheService->clearAllCacheByModel(); } /** * Handle the Post "restored" event. */ public function restored(Post $post): void { // } /** * Handle the Post "force deleted" event. */ public function forceDeleted(Post $post): void { // } }