Error is:
Serialization of 'Closure' is not allowed
Error at:
.../vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php:295
Throws when remembering forever on Cache for the first time. After second try (when reloading browser) it works as it should work.
public function cache()
{
$task = $this;
return Cache::rememberForever('apply:' . $task->apply->slug . ':' . $task->slug, function () use ($task) {
return $task;
});
}
Interesting part is this. So it works on caching $apply
on Apply's index page. (The code is the same)
Note: This issue is related to Redis directly. Please don't mention old questions about serialization. You can check official Laravel 6.x documentation too. Everything is added related to it: https://laravel.com/docs/6.x/cache#retrieving-items-from-the-cache