Reputation: 3957
I'm trying to call Auth::user() in my routes/api.php file.
Auth::user()
routes/api.php
But the Auth::user() returns null.
null
Meanwhile, as in the routes/web.php file it work.
routes/web.php
How to fix it?
I will be grateful...
Upvotes: 2
Views: 1151
Reputation: 9853
Call with guard()
guard()
Auth::guard('api')->user();
Upvotes: 3