Skip to content

Commit fb8166c

Browse files
authored
Correct way to catch all Eloquent events
1 parent 7069c0a commit fb8166c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/LaravelCacheServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function boot()
2828
return $this->app->make(CacheManager::class)->store()->getStore();
2929
});
3030

31-
Event::listen(['eloquent.saved: *', 'eloquent.deleted: *', 'eloquent.restored: *'], function (Model $model) {
31+
Event::listen(['eloquent.created: *', 'eloquent.updated: *', 'eloquent.deleted: *', 'eloquent.restored: *'], function (Model $model) {
3232
/** @var CacheInvalidator $cacheInvalidator */
3333
$cacheInvalidator = $this->app->make(CacheInvalidator::class);
3434
$cacheInvalidator->invalidateByModel($model);

0 commit comments

Comments
 (0)