class TokenGuard implements Guard

Traits

These methods are typically the same across all guards.

Properties

protected Authenticatable $user

The currently authenticated user.

from  GuardHelpers
protected UserProvider $provider

The user provider implementation.

from  GuardHelpers
protected Request $request

The request instance.

protected string $inputKey

The name of the query string item from the request containing the API token.

protected string $storageKey

The name of the token "column" in persistent storage.

Methods

authenticate()

Determine if the current user is authenticated.

bool
check()

Determine if the current user is authenticated.

bool
guest()

Determine if the current user is a guest.

int|null
id()

Get the ID for the currently authenticated user.

$this
setUser(Authenticatable $user)

Set the current user.

void
__construct(UserProvider $provider, Request $request)

Create a new authentication guard.

user()

Get the currently authenticated user.

string
getTokenForRequest()

Get the token for the current request.

bool
validate(array $credentials = [])

Validate a user's credentials.

$this
setRequest(Request $request)

Set the current request instance.

Details

in GuardHelpers at line 33
Authenticatable authenticate()

Determine if the current user is authenticated.

Return Value

Authenticatable

Exceptions

AuthenticationException

in GuardHelpers at line 47
bool check()

Determine if the current user is authenticated.

Return Value

bool

in GuardHelpers at line 57
bool guest()

Determine if the current user is a guest.

Return Value

bool

in GuardHelpers at line 67
int|null id()

Get the ID for the currently authenticated user.

Return Value

int|null

in GuardHelpers at line 80
$this setUser(Authenticatable $user)

Set the current user.

Parameters

Authenticatable $user

Return Value

$this

at line 41
void __construct(UserProvider $provider, Request $request)

Create a new authentication guard.

Parameters

UserProvider $provider
Request $request

Return Value

void

at line 54
Authenticatable|null user()

Get the currently authenticated user.

Return Value

Authenticatable|null

at line 81
string getTokenForRequest()

Get the token for the current request.

Return Value

string

at line 106
bool validate(array $credentials = [])

Validate a user's credentials.

Parameters

array $credentials

Return Value

bool

at line 127
$this setRequest(Request $request)

Set the current request instance.

Parameters

Request $request

Return Value

$this