Skip to content

Commit abea74e

Browse files
author
Shawn McCool
committed
Merge branch 'hotfix/akuza'
2 parents 12dd21f + 48258b3 commit abea74e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

auth/usage.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,26 @@ Logging a user into your application is simple using the **attempt** method on t
4040

4141
If the user's credentials are valid, the user ID will be stored in the session and the user will be considered "logged in" on subsequent requests to your application.
4242

43+
By default a user's auth session will expire when their browser has been closed. You can enable Laravel's "remember me" functionality by passing **true** as the third parameter to the **attempt** method.
44+
45+
if (Auth::attempt('[email protected]', 'password', true))
46+
...
47+
4348
You probably noticed this method name corresponds to the **attempt** function you [configured earlier](/docs/auth/config#attempt). Each time you call the **attempt** method on the **Auth** class, the **attempt** function in the configuration file will be called to check the user's credentials.
4449

4550
> **Note:** To provide more flexiblity when working with third-party authentication providers, you are not required to pass a password into the **attempt** method.
4651
47-
To determine if the user of your application is logged in, call the **check** method:
52+
To determine if the user of your application is logged in, call either the **check** or **guest** methods:
4853

4954
if (Auth::check())
5055
{
5156
return "You're logged in!";
5257
}
58+
59+
if (Auth::guest())
60+
{
61+
return "You're not logged in!";
62+
}
5363

5464
Use the **login** method to login a user without checking their credentials, such as after a user first registers to use your application. Just pass your user object or the user's ID:
5565

0 commit comments

Comments
 (0)