Martney Acha
Martney Acha

Reputation: 3002

Serialization of 'Closure' is not allowed in laravel

I have a request in laravel which is I needed to store in session what I'm try to do is store all the request in a session to lesson the coding which is this one:

public function store(Request $request)
{
    session()->put('quotation',  $request);
    return 'success';
}

What it does is it is storing all the request to session but I am encountering an error

(1/1) Exception Serialization of 'Closure' is not allowed

I'm using laravel 5.4

Upvotes: 0

Views: 7590

Answers (1)

lagbox
lagbox

Reputation: 50481

The Request object has Closures as properties. You probably don't need the entire Request object but only the inputs. If you only need the inputs you can save the array of inputs:

$request->session()->put('quotation', $request->input());

quotation will contain an array of the inputs.

Upvotes: 5

Related Questions