How to flush Laravel cache before saving the Model
Categorized as Laravel
You can make some improvement to your code, if you want to reset the cache on creating or updating a Model in Laravel. See the code below:
class Post extends Model
{
public static function boot()
{
parent::boot();
static::saving(function () {
Cache::forget('posts');
});
}
}