GuardHelpers
trait GuardHelpers
These methods are typically the same across all guards.
In Hypervel, guards are process-global singletons (cached in AuthManager::$guards), so per-request user state cannot be stored as instance properties. Each guard must implement its own coroutine-safe user(), setUser(), and hasUser() using Context. This trait provides only the methods that are truly universal across all guards.
Properties
| protected UserProvider|null | $provider | The user provider implementation. |
Methods
Determine if the current user is authenticated. If not, throw an exception.
Determine if the current user is authenticated.
Determine if the current user is a guest.
Get the ID for the currently authenticated user.
Get the user provider used by the guard.
Details
at line 32
Authenticatable
authenticate()
Determine if the current user is authenticated. If not, throw an exception.
at line 40
bool
check()
Determine if the current user is authenticated.
at line 48
bool
guest()
Determine if the current user is a guest.
at line 56
int|string|null
id()
Get the ID for the currently authenticated user.
at line 64
UserProvider|null
getProvider()
Get the user provider used by the guard.
at line 75
void
setProvider(UserProvider $provider)
Set the user provider used by the guard.
Boot or tests only. The provider is stored on the worker-lifetime guard and affects every subsequent request.