You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today we implemented new feature Model::automaticallyEagerLoadRelationships(); into AppServiceProvider boot method. When we try to store Model instance into redis, the exception Serialization of 'Closure' is not allowed is thrown.
If I remove automaticallyEagerLoadRelationships from AppServiceProvider, everything works fine.
After quick check, the problem should be in file src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php because the property $relationAutoloadCallback can contain closure, which cannot be serialized.
Steps To Reproduce
Add into boot method in AppService provider Model::automaticallyEagerLoadRelationships();
Retrieve data from database into Model, for example: $data = Language::query()->firstWhere('language', $language);
Try to save it into redis via Cache::put($cacheKey, $data, Carbon::now()->addDay());
Exception Serialization of 'Closure' is not allowed. is thrown