Unable to prepare route [api/user]
for serialization. Uses Closure. at vendor/laravel/framework/src/Illuminate/Routing/Route.php:1150
Unable to prepare route [api/user]
for serialization. Uses Closure. at vendor/laravel/framework/src/Illuminate/Routing/Route.php:1150
2
Answers
pls run php artisan route:list and check if there is any Closure in that list.
You can’t cache routes if you are using a closure. The closure is this part
public function (Request $request) { return $request->user(); }
Instead, if you move the code into a controller you’ll be able to cache the routes and eliminate the error.