Amitabh kumar
Amitabh kumar

Reputation: 85

Serialization of 'Closure' is not allowed laravel 9

I am getting the document saved with the user's information. Or sending document to email when I open email and click on link then I am getting error how to solve it. Error "Serialization of 'Closure' is not allowed";

What to do solve this issue.

enter image description here

enter image description here

Upvotes: 2

Views: 3285

Answers (2)

TheDeon
TheDeon

Reputation: 21

I got this error when I tried to write to the session. request()->session()->put('url.intended', url($slug)); but $slug was null, so just wrapped it in an if and that seemed to resolve the issue

Upvotes: 0

Honk der Hase
Honk der Hase

Reputation: 2488

Closures are PHP Code, which is not serializable by design, just like resources (open file pointers, database connections, ...).

You'll have to remove those things from your data structure before serializing it.

Upvotes: 2

Related Questions