Andreas94
1 year ago
10826
8
Laravel

Error Unable to prepare route [api/user] for serialization. Uses Closure.

Posted 1 year ago by Andreas94

Hi guys, I have been carrying this error for several months, which is not a problem but I want to solve it:

In Route.php line 917:

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

I read that you have to comment on the code in route / api.php

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

after giving the command php artisan route:cache

But now I get the error:

In Route.php line 917:

  Unable to prepare route [{fallbackPlaceholder}] for serialization. Uses Closure.

Please sign in or create an account to participate in this conversation.