1. Home
  2. Laravel
  3. Auth helpers

Auth helper functions.

#laravel#auth
auth()->id()    // Returns null if the user is not logged in or a User id if they are.
auth()->user()  // Returns a User instance.
auth()->check() // Returns boolean: true for logged in.
auth()->guest() // Returns boolean: true for a guest user.
 
copy
Full Laravel cheatsheet