LogicException : Unable to prepare route [cache/clear-cache] for serialization. Uses Closure.

LogicException  : Unable to prepare route [cache/clear-cache] for serialization. Uses Closure.

If  You want to run php artisan route:cache but you are getting some error then you must need  to do certain thing.

Step1:

go to routes folder and check web.php and api.php

Step 2:

check for the route closer function if exist then convert to the controller

Step 3: You can see, In the picture which is the example of closer function in route so you need to  direct to controller. 

This is closer and can not be serialized

Step 4:

After that again run php artisan route:cache your problem will be gone


So this is the simple solution for your problem 

That you got " LogicException : Unable to prepare route [cache/clear-cache] for serializati
on. Uses Closure."

 

Note :you can't use route caching if you have any route closures function . Make a controller as per your wish and use your logic to direct your route to the Controller/Method.