Public Methods

public getImpersonator()

public getImpersonator(): Illuminate\Contracts\Auth\Authenticatable|null 

getImpersonator gets the original user doing the impersonation

public getRealUser()

public getRealUser(): Authenticatable|null 

getRealUser gets the "real" user to bypass impersonation.

public impersonate()

public impersonate($user): void

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

public impersonateRole()

public impersonateRole($role): void

impersonateRole will impersonate a role for the current user

public isImpersonator()

public isImpersonator(): bool 

isImpersonator checks to see if the current session is being impersonated.

public isRoleImpersonator()

public isRoleImpersonator(): bool 

public stopImpersonate()

public stopImpersonate(): void

stopImpersonate stops the current session being impersonated and attempts to authenticate as the impersonator again.

public stopImpersonateRole()

public stopImpersonateRole(): void

stopImpersonateRole will stop role impersonation

Protected Methods

protected applyRoleImpersonation()

protected applyRoleImpersonation($user): void

applyRoleImpersonation tells the user model to impersonate the role