[LogicException] Unable to prepare route for serialization. Uses Closure.
This blog post was originally published a little while ago. Please consider that it may no longer be relevant or even accurate.
Ran into this little issue when trying to use route:cache
on Laravel 5.
The exception is pretty clear, but it's worth noting that closure type routes will not be compatible when trying to use the route:cache
command. You have a couple of options: forgo cached routing and the speed improvement or move your routes into a controller. I did the latter.
Now that your routing is handled by a controller instead of a closure you'll be able to cache your routes as you want.