Search code examples
phplaravellaravel-5.3laravel-routinglaravel-artisan

Broken Laravel after performing optimization commands


I got some problem loading a class from a package so i try to run -as suggested by a lot of user- these commands in order to make my class searchable by my files:

php artisan optimize
php artisan config:cache 
php artisan route:cache

Last one command give me back this error as output:

[LogicException]
Unable to prepare route [/] for serialization. Uses Closure.

After this i run again my site and ive got this lovely mex:

Whoops, looks like something went wrong.

And i cant even browse my site now! what happend? How can I fix it?


Solution

  • You can't serialise a closure. Please see this answer. Exception: Serialization of 'Closure' is not allowed

    Look fort some code where you have said

    $xyz = function(){//etc} for your / route.