Unable to prepare route [api/user]
for serialization. Uses Closure. at vendor/laravel/framework/src/Illuminate/Routing/Route.php:1150
Asked
Active
Viewed 139 times
-3

Nour Rachana
- 3
- 2
-
Possible duplicate: https://stackoverflow.com/q/45266254/9636400. – geertjanknapen Feb 16 '23 at 07:08
2 Answers
0
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.

Shubham Rana
- 26
- 5