Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

MethodDescriptionUsageReturns
isLoggedIn()

Check if a user is logged in or not.

Code Block
languagephp
if (auth()->isLoggedIn()) {
	echo "Hello logged in user!";
}

true if logged in, false if not

membersOnly()

Redirect a user to the login page if they are

not logged in.

Code Block
languagephp
route('/bar', function() {

   // This will redirect the user if they are not logged in
   auth()->membersOnly();

});
null
isAdmin()Checks to see if a user is a site Admin
Code Block
languagephp
if (auth()->isAdmin()) {
	echo "Hello Admin!";
}
true if logged in, false if not