Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

how to check if a user is logged in in a non middleware controller in laravel

How to check if a user is logged in, in a non middleware controller
  in laravel?
  
  auth Auth::guard
    
    if (Auth::guard('api')->check()){ //will return true if logged in
      //do this 
    }
  else //if the user is not logged in
  {
    //do this
  }
 
PREVIOUS NEXT
Tagged: #check #user #logged #middleware #controller #laravel
ADD COMMENT
Topic
Name
3+9 =