class RequestGuard 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
static protected array $macros

The registered string macros.

from  Macroable
protected callable $callback

The guard callback.

protected Request $request

The request instance.

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.

static void
macro(string $name, callable $macro)

Register a custom macro.

static bool
hasMacro(string $name)

Checks if macro is registered.

static mixed
__callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

mixed
__call(string $method, array $parameters)

Dynamically handle calls to the class.

void
__construct(callable $callback, Request $request)

Create a new authentication guard.

user()

Get the currently authenticated user.

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

in Macroable at line 24
static void macro(string $name, callable $macro)

Register a custom macro.

Parameters

string $name
callable $macro

Return Value

void

in Macroable at line 35
static bool hasMacro(string $name)

Checks if macro is registered.

Parameters

string $name

Return Value

bool

in Macroable at line 49
static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in Macroable at line 71
mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

at line 34
void __construct(callable $callback, Request $request)

Create a new authentication guard.

Parameters

callable $callback
Request $request

Return Value

void

at line 45
Authenticatable|null user()

Get the currently authenticated user.

Return Value

Authenticatable|null

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

Validate a user's credentials.

Parameters

array $credentials

Return Value

bool

at line 78
$this setRequest(Request $request)

Set the current request instance.

Parameters

Request $request

Return Value

$this