PersonalAccessToken
extends PersonalAccessToken
in package
Table of Contents
Properties
- $fillable : mixed
Methods
- cacheToken() : void
- Cache token instance.
- createToken() : NewAccessToken
- Create a new personal access token for the user.
- findToken() : static|null
- Find the token instance matching the given token.
- invalidateTokenCache() : void
- Invalidate token cache by ID.
- prepareDeviceFromRequest() : array<string|int, mixed>
- booted() : void
- The "booted" method of the model.
- expiresAt() : Attribute
- Get the expiration time as a Carbon instance.
- findTokenFromCache() : static|null
- Find token from Redis cache or database with caching.
- findTokenWithoutCache() : static|null
- Find token without using cache (fallback method).
- scopeWhereExpired() : mixed
Properties
$fillable
protected
mixed
$fillable
= ['name', 'token', 'abilities', 'expires_at', 'user_agent', 'device_operating_system', 'device_name', 'client_fingerprint', 'session_id', 'ip_address', 'ip_history', 'ip_change_count', 'country_code', 'city', 'last_geo_notification_at']
Methods
cacheToken()
Cache token instance.
public
static cacheToken(PersonalAccessToken $token) : void
Parameters
- $token : PersonalAccessToken
createToken()
Create a new personal access token for the user.
public
static createToken(mixed $tokenable, string $name[, array<string|int, mixed> $abilities = ['*'] ][, DateTimeInterface|null $expiresAt = null ]) : NewAccessToken
Parameters
- $tokenable : mixed
- $name : string
- $abilities : array<string|int, mixed> = ['*']
- $expiresAt : DateTimeInterface|null = null
Return values
NewAccessTokenfindToken()
Find the token instance matching the given token.
public
static findToken(string $token) : static|null
Parameters
- $token : string
Return values
static|nullinvalidateTokenCache()
Invalidate token cache by ID.
public
static invalidateTokenCache(int $tokenId) : void
Parameters
- $tokenId : int
prepareDeviceFromRequest()
public
static prepareDeviceFromRequest(Request $request) : array<string|int, mixed>
Parameters
- $request : Request
Attributes
- #[ArrayShape]
- ['user_agent' => "null|string", 'device_operating_system' => "null|string", 'device_name' => "null|string"]
Return values
array<string|int, mixed>booted()
The "booted" method of the model.
protected
static booted() : void
expiresAt()
Get the expiration time as a Carbon instance.
protected
expiresAt() : Attribute
Return values
AttributefindTokenFromCache()
Find token from Redis cache or database with caching.
protected
static findTokenFromCache(string $id, string $tokenValue) : static|null
Parameters
- $id : string
- $tokenValue : string
Return values
static|nullfindTokenWithoutCache()
Find token without using cache (fallback method).
protected
static findTokenWithoutCache(string $token) : static|null
Parameters
- $token : string
Return values
static|nullscopeWhereExpired()
protected
scopeWhereExpired(Builder $q) : mixed
Parameters
- $q : Builder