class Manager

Auth Manager Class Adapted from Ion Auth.

Constants

AUTH_KEY_NAME

Properties

protected $sessionKey
protected User $user
protected string $model
protected $requireApproval
protected bool $useSession
protected bool $viaRemember

Methods

check()

Determine if the current user is authenticated.

guest()

Determine if the current user is a guest.

user()

Get the currently authenticated user.

int|null
id()

Get the ID for the currently authenticated user.

getUser()

Get the currently authenticated user model.

setUser($user)

Set the current user model

User|bool
authenticate(array $credentials = [], bool $remember = false, bool $login = true)

Validate a user using the given credentials.

bool
once(array $credentials = [])

Log a user into the application without sessions or cookies.

Authenticatable|false
onceUsingId(mixed $id)

Log the given user ID into the application without sessions or cookies.

login(Authenticatable $user, bool $remember = false)

Log a user into the application.

mixed
loginUsingId($id, bool $remember = false)

Log the given user ID into the application.

void
logout()

Log the user out of the application.

bool
viaRemember()

Determine if the user was authenticated via "remember me" cookie.

Authenticatable|User
getById($identifier)

No description

mixed
getByToken($identifier, $token)

No description

null|User
getByCredentials(array $credentials)

No description

validateCredentials(User $user, $credentials)

No description

mixed
createModel()

Create a new instance of the model if it does not already exist.

createModelQuery()

Prepares a query derived from the user model.

void
extendUserQuery(Builder $query)

Extend the query used for finding the user.

string
getModel()

Gets the name of the user model

$this
setModel($model)

Sets the name of the user model

array
getPersistData(Authenticatable|User $user)

Create a new "remember me" token for the user

impersonate(User $user)

Impersonates the given user and sets properties in the session but not the cookie.

stopImpersonate()

No description

isImpersonator()

No description

getImpersonator()

No description

Details

at line 50
check()

Determine if the current user is authenticated.

at line 96
guest()

Determine if the current user is a guest.

at line 106
User user()

Get the currently authenticated user.

Return Value

User

at line 119
int|null id()

Get the ID for the currently authenticated user.

Return Value

int|null

at line 128
User getUser()

Get the currently authenticated user model.

Return Value

User

at line 138
setUser($user)

Set the current user model

Parameters

$user

at line 153
User|bool authenticate(array $credentials = [], bool $remember = false, bool $login = true)

Validate a user using the given credentials.

Parameters

array $credentials
bool $remember
bool $login

Return Value

User|bool

Exceptions

Exception

at line 176
bool once(array $credentials = [])

Log a user into the application without sessions or cookies.

Parameters

array $credentials

Return Value

bool

at line 193
Authenticatable|false onceUsingId(mixed $id)

Log the given user ID into the application without sessions or cookies.

Parameters

mixed $id

Return Value

Authenticatable|false

at line 212
login(Authenticatable $user, bool $remember = false)

Log a user into the application.

Parameters

Authenticatable $user
bool $remember

Exceptions

Exception

at line 247
mixed loginUsingId($id, bool $remember = false)

Log the given user ID into the application.

Parameters

$id
bool $remember

Return Value

mixed

Exceptions

Exception

at line 262
void logout()

Log the user out of the application.

Return Value

void

at line 290
bool viaRemember()

Determine if the user was authenticated via "remember me" cookie.

Return Value

bool

at line 304
Authenticatable|User getById($identifier)

No description

Parameters

$identifier

Return Value

Authenticatable|User

at line 318
mixed getByToken($identifier, $token)

No description

Parameters

$identifier
$token

Return Value

mixed

Exceptions

Exception

at line 334
null|User getByCredentials(array $credentials)

No description

Parameters

array $credentials

Return Value

null|User

at line 350
validateCredentials(User $user, $credentials)

No description

Parameters

User $user
$credentials

at line 368
mixed createModel()

Create a new instance of the model if it does not already exist.

Return Value

mixed

Exceptions

Exception

at line 383
protected createModelQuery()

Prepares a query derived from the user model.

at line 399
void extendUserQuery(Builder $query)

Extend the query used for finding the user.

Parameters

Builder $query

Return Value

void

at line 407
string getModel()

Gets the name of the user model

Return Value

string

at line 419
$this setModel($model)

Sets the name of the user model

Parameters

$model

Return Value

$this

at line 432
protected array getPersistData(Authenticatable|User $user)

Create a new "remember me" token for the user

Parameters

Authenticatable|User $user

Return Value

array

at line 451
impersonate(User $user)

Impersonates the given user and sets properties in the session but not the cookie.

Parameters

User $user

Exceptions

Exception

at line 464
stopImpersonate()

No description

at line 480
isImpersonator()

No description

at line 485
getImpersonator()

No description