trait InteractsWithAuthentication (View source)

Methods

$this
actingAs(Authenticatable $user, string|null $driver = null)

Set the currently logged in user for the application.

$this
be(Authenticatable $user, string|null $driver = null)

Set the currently logged in user for the application.

$this
assertAuthenticated(string|null $guard = null)

Assert that the user is authenticated.

$this
assertGuest(string|null $guard = null)

Assert that the user is not authenticated.

bool
isAuthenticated(string|null $guard = null)

Return true if the user is authenticated, false otherwise.

$this
assertAuthenticatedAs(Authenticatable $user, string|null $guard = null)

Assert that the user is authenticated as the given user.

$this
assertCredentials(array $credentials, string|null $guard = null)

Assert that the given credentials are valid.

$this
assertInvalidCredentials(array $credentials, string|null $guard = null)

Assert that the given credentials are invalid.

bool
hasCredentials(array $credentials, string|null $guard = null)

Return true if the credentials are valid, false otherwise.

Details

$this actingAs(Authenticatable $user, string|null $driver = null)

Set the currently logged in user for the application.

Parameters

Authenticatable $user
string|null $driver

Return Value

$this

$this be(Authenticatable $user, string|null $driver = null)

Set the currently logged in user for the application.

Parameters

Authenticatable $user
string|null $driver

Return Value

$this

$this assertAuthenticated(string|null $guard = null)

Assert that the user is authenticated.

Parameters

string|null $guard

Return Value

$this

$this assertGuest(string|null $guard = null)

Assert that the user is not authenticated.

Parameters

string|null $guard

Return Value

$this

protected bool isAuthenticated(string|null $guard = null)

Return true if the user is authenticated, false otherwise.

Parameters

string|null $guard

Return Value

bool

$this assertAuthenticatedAs(Authenticatable $user, string|null $guard = null)

Assert that the user is authenticated as the given user.

Parameters

Authenticatable $user
string|null $guard

Return Value

$this

$this assertCredentials(array $credentials, string|null $guard = null)

Assert that the given credentials are valid.

Parameters

array $credentials
string|null $guard

Return Value

$this

$this assertInvalidCredentials(array $credentials, string|null $guard = null)

Assert that the given credentials are invalid.

Parameters

array $credentials
string|null $guard

Return Value

$this

protected bool hasCredentials(array $credentials, string|null $guard = null)

Return true if the credentials are valid, false otherwise.

Parameters

array $credentials
string|null $guard

Return Value

bool