6 months ago

Auth::user() in api route

Posted 6 months ago by emfpc

When using controllers i can run if statement in the function without using a middle ware to determine if a user has a role or is log in; example: if(Auth::user()->role == 'admin'){ return 'I'm Admin'; }else{ return 'i'm not admin; } something like that. But i wan't to use the same when using api routes; i understand there's a few stuff to be considered; is there away to use this simple logic for it?

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