Sanctum
class Sanctum
Constants
| protected DEFAULT_PERSONAL_ACCESS_TOKEN_MODEL |
|
Properties
| static TToken> | $personalAccessTokenModel | The personal access client model class name. |
|
| static null|callable | $accessTokenRetrievalCallback | A callback that can get the token from the request. |
|
| static null|callable | $accessTokenAuthenticationCallback | A callback that can add to the validation of the access token. |
|
| static string | $currentRequestHostPlaceholder | A placeholder to instruct Sanctum to include the current request host in the list of stateful domains. |
Methods
Get the current application URL from the "APP_URL" environment variable - with port.
Get a fixed token instructing Sanctum to include the current request host in the list of stateful domains.
Set the current user for the application with the given abilities.
Set the personal access token model name.
Specify a callback that should be used to fetch the access token from the request.
Specify a callback that should be used to authenticate access tokens.
Get the token model class name.
Flush all static state.
Details
at line 48
static string
currentApplicationUrlWithPort()
Get the current application URL from the "APP_URL" environment variable - with port.
at line 58
static string
currentRequestHost()
Get a fixed token instructing Sanctum to include the current request host in the list of stateful domains.
at line 69
static mixed
actingAs(HasApiTokens $user, array $abilities = [], string $guard = 'sanctum')
Set the current user for the application with the given abilities.
at line 105
static void
usePersonalAccessTokenModel(string $model)
Set the personal access token model name.
Boot-only. The model class name persists in a static property for the worker lifetime and is used for every token resolution across all coroutines.
at line 116
static void
getAccessTokenFromRequestUsing(callable|null $callback)
Specify a callback that should be used to fetch the access token from the request.
Boot-only. The callback persists in a static property for the worker lifetime and runs on every token retrieval across all coroutines.
at line 127
static void
authenticateAccessTokensUsing(callable $callback)
Specify a callback that should be used to authenticate access tokens.
Boot-only. The callback persists in a static property for the worker lifetime and runs on every token authentication across all coroutines.
at line 137
static string
personalAccessTokenModel()
Get the token model class name.
at line 145
static void
flushState()
Flush all static state.