why?? "Unable to prepare route ... for serialization. Uses Closure."

Posted 3 years ago by andy

When I do "route:clear" I get this error:

Unable to prepare route [language/{lang}] for serialization. Uses Closure.

The route that is causing this is:

Route::get('/language/{lang}', function ($lang) {
    Session::put('locale', $lang);
    return Redirect::back();

I'm trying to understand this problem, my questions are:

  1. Why is this happening? Meaning, I based that route off the docs and I can't seem to understand why would a documented suggestion cause an error.

  2. What is a solution or even does anybody have a link to share?


Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.