class DeveloperAccessToken extends AccessToken
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 | $customRelations | from AbstractModel |
|
|
| static | $dateAttributes | from AbstractModel |
|
|
| static | $defaults | from AbstractModel |
|
|
| protected | $table | from AccessToken |
|
|
| protected | $dates | from AccessToken |
|
|
| static protected array | $models | A map of access token types, as specified in the `type` column, to their classes. | from AccessToken |
|
| static | $type |
|
||
| static protected | $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 | $last_ip_address | from AccessToken |
|
|
| string | $last_user_agent | from AccessToken |
|
|
| User|null | $user | from AccessToken |
|
Methods
Get an attribute from the model. If nothing is found, attempt to load a custom relation method with this key.
Register a callback to be run once after the model is saved.
Register a callback to be run once after the model is deleted.
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.
Set the model for the given access token type.
Details
in AbstractModel
at
line 65
static
boot()
{@inheritdoc}
in AbstractModel
at
line 85
__construct(array $attributes = [])
{@inheritdoc}
in AbstractModel
at
line 105
array
getDates()
Get the attributes that should be converted to dates.
in AbstractModel
at
line 123
mixed
getAttribute(string $key)
Get an attribute from the model. If nothing is found, attempt to load a custom relation method with this key.
in AbstractModel
at
line 149
protected mixed
getCustomRelation(string $name)
Get a custom relation object.
in AbstractModel
at
line 165
void
afterSave(callable $callback)
Register a callback to be run once after the model is saved.
in AbstractModel
at
line 176
void
afterDelete(callable $callback)
Register a callback to be run once after the model is deleted.
in AbstractModel
at
line 184
callable[]
releaseAfterSaveCallbacks()
in AbstractModel
at
line 196
callable[]
releaseAfterDeleteCallbacks()
in AbstractModel
at
line 208
__call($method, $arguments)
{@inheritdoc}
in AccessToken
at
line 78
static AccessToken
generate(int $userId)
Generate an access token for the specified user.
in AccessToken
at
line 102
bool
touch(ServerRequestInterface $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 132
BelongsTo
user()
Define the relationship with the owner of this access token.
in AccessToken
at
line 143
static protected
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 156
static protected
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 170
static AccessToken|null
findValid(string $token)
Shortcut to find a valid token.
in AccessToken
at
line 180
scopeWhereValid(Builder $query, Carbon $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 201
scopeWhereExpired(Builder $query, Carbon $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 224
AccessToken|object
newFromBuilder(array $attributes = [], string|null $connection = null)
Create a new model instance according to the access token type.
in AccessToken
at
line 249
static array
getModels()
Get the type-to-model map.
in AccessToken
at
line 261
static void
setModel(string $type, string $model)
Set the model for the given access token type.