Skip to content

Commit 4314ea3

Browse files
authored
Merge pull request #16 from eschricker/doc/update-auth-guard
Migrated PR 2110 - Update auth-guard.md
2 parents 48015c4 + e3497a5 commit 4314ea3

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

docs/auth-guard.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ try {
5858

5959
```
6060

61-
If the user is not set, then a `PHPOpenSourceSaver\JWTAuth\Exceptions\UserNotDefinedException` will be thrown
61+
If the user is not set, then a `PHPOpenSourceSaver\JWTAuth\Exceptions\UserNotDefinedException` will be thrown.
6262

6363
### logout()
6464

@@ -73,7 +73,7 @@ auth()->logout(true);
7373

7474
### refresh()
7575

76-
Refresh a token, which invalidates the current one
76+
Refresh a token, which invalidates the current one.
7777

7878
```php
7979
$newToken = auth()->refresh();
@@ -85,7 +85,7 @@ $newToken = auth()->refresh(true, true);
8585

8686
### invalidate()
8787

88-
Invalidate the token (add it to the blacklist)
88+
Invalidate the token (add it to the blacklist).
8989

9090
```php
9191
auth()->invalidate();
@@ -104,7 +104,7 @@ $token = auth()->tokenById(123);
104104

105105
### payload()
106106

107-
Get the raw JWT payload
107+
Get the raw JWT payload.
108108

109109
```php
110110
$payload = auth()->payload();
@@ -118,7 +118,7 @@ $payload->toArray(); // = ['sub' => 123, 'exp' => 123456, 'jti' => 'asfe4fq434as
118118

119119
### validate()
120120

121-
Validate a user's credentials
121+
Validate a user's credentials.
122122

123123
```php
124124
if (auth()->validate($credentials)) {
@@ -147,7 +147,8 @@ $user = auth()->setRequest($request)->user();
147147
```
148148

149149
### Override the token ttl
150+
This example sets the token to expire after 2 hours.
150151

151152
```php
152-
$token = auth()->setTTL(7200)->attempt($credentials);
153+
$token = auth()->setTTL(120)->attempt($credentials);
153154
```

0 commit comments

Comments
 (0)