Closed kasperpeulen closed 7 years ago
I think now I understand:
\View::composer('*', function ($view) {
$channels = \Cache::rememberForever('channels3', function () {
$channels = Channel::all();
return $channels;
});
$view->with('channels', $channels);
});
My database was not seeded when I started this project, so my channels will now (forever?) be empty. Because dd($channels)
give an empty collection. Can I reset this cache somehow?
You can call 'php artisan cache:clear'
or you can listen eloquent model events
public static function boot()
{
parent::boot();
static::created(function ($model)
{
// Clear Cache commands
});
}