class SessionAccessToken extends AccessToken
Traits
Constants
| LAST_ACTIVITY_UPDATE_DIFF |
Difference from the current `last_activity_at` attribute value before `updateLastSeen()` will update the attribute on the DB. Measured in seconds. |
Properties
| bool | $timestamps | Indicates if the model should be timestamped. Turn off by default. | from AbstractModel |
|
| protected callable[] | $afterSaveCallbacks | An array of callbacks to be run once after the model is saved. | from AbstractModel |
|
| protected callable[] | $afterDeleteCallbacks | An array of callbacks to be run once after the model is deleted. | from AbstractModel |
|
| static array | $customCasts | from AbstractModel |
|
|
| static array | $defaults | from AbstractModel |
|
|
| protected string|null | $tableAlias | An alias for the table name, used in queries. | from AbstractModel |
|
| array|null | $uniqueKeys | from AccessToken |
|
|
| static protected array | $visibilityScopers | from ScopeVisibilityTrait |
|
|
| protected | $table | from AccessToken |
|
|
| protected | $casts | from AccessToken |
|
|
| static protected array | $models | A map of access token types, as specified in the `type` column, to their classes. | from AccessToken |
|
| static string | $type |
|
||
| static protected int | $lifetime |
|
||
| int | $id | from AccessToken |
|
|
| string | $token | from AccessToken |
|
|
| int | $user_id | from AccessToken |
|
|
| Carbon | $created_at | from AccessToken |
|
|
| Carbon|null | $last_activity_at | from AccessToken |
|
|
| string | $title | from AccessToken |
|
|
| string|null | $last_ip_address | from AccessToken |
|
|
| string|null | $last_user_agent | from AccessToken |
|
|
| User|null | $user | from AccessToken |
|
|
| $hidden |
|
Methods
Register a callback to be run once after the model is saved.
Register a callback to be run once after the model is deleted.
No description
Scope a query to only include records that are visible to a user.
Generate an access token for the specified user.
Update the time of last usage of a token.
Filters which tokens are valid at the given date for this particular token type.
Filters which tokens are expired at the given date and ready for garbage collection.
This query scope is intended to be used on the base AccessToken object to query for valid tokens of any type.
This query scope is intended to be used on the base AccessToken object to query for expired tokens of any type.
Create a new model instance according to the access token type.
Details
in AbstractModel
at
line 71
static
boot()
in AbstractModel
at
line 88
__construct(array $attributes = [])
in AbstractModel
at
line 103
array
getCasts()
in AbstractModel
at
line 117
void
afterSave(callable $callback)
Register a callback to be run once after the model is saved.
in AbstractModel
at
line 125
void
afterDelete(callable $callback)
Register a callback to be run once after the model is deleted.
in AbstractModel
at
line 133
array
releaseAfterSaveCallbacks()
in AbstractModel
at
line 145
array
releaseAfterDeleteCallbacks()
in AbstractModel
at
line 157
newModelQuery()
in AbstractModel
at
line 169
qualifyColumn($column)
in AbstractModel
at
line 178
mixed
withTableAlias(callable $callback)
in AbstractModel
at
line 191
Collection
newCollection(array $models = [])
in AbstractModel
at
line 197
__sleep()
in ScopeVisibilityTrait
at
line 28
static void
registerVisibilityScoper(callable $scoper, string|null $ability = null)
in ScopeVisibilityTrait
at
line 44
Builder
scopeWhereVisibleTo(Builder $query, User $actor, string $ability = 'view')
Scope a query to only include records that are visible to a user.
in ScopeVisibilityTrait
at
line 19
static Builder
whereVisibleTo(User $user)
in AccessToken
at
line 81
static AccessToken
generate(int $userId)
Generate an access token for the specified user.
in AccessToken
at
line 89
static AccessToken
make(int $userId)
in AccessToken
at
line 109
bool
touch($attribute = null, ServerRequestInterface|null $request = null)
Update the time of last usage of a token.
If a request object is provided, the IP address and User Agent will also be logged.
in AccessToken
at
line 147
BelongsTo
user()
in AccessToken
at
line 156
static protected void
scopeValid(Builder $query, Carbon $date)
Filters which tokens are valid at the given date for this particular token type.
Uses the static::$lifetime value by default, can be overridden by children classes.
in AccessToken
at
line 167
static protected void
scopeExpired(Builder $query, Carbon $date)
Filters which tokens are expired at the given date and ready for garbage collection.
Uses the static::$lifetime value by default, can be overridden by children classes.
in AccessToken
at
line 180
static AccessToken|null
findValid(string $token)
Shortcut to find a valid token.
in AccessToken
at
line 188
void
scopeWhereValid(Builder $query, Carbon|null $date = null)
This query scope is intended to be used on the base AccessToken object to query for valid tokens of any type.
in AccessToken
at
line 207
void
scopeWhereExpired(Builder $query, Carbon|null $date = null)
This query scope is intended to be used on the base AccessToken object to query for expired tokens of any type.
in AccessToken
at
line 230
AccessToken|object
newFromBuilder(array $attributes = [], string|null $connection = null)
Create a new model instance according to the access token type.
in AccessToken
at
line 253
static array
getModels()
Get the type-to-model map.