class SessionAccessToken extends AccessToken
Constants
LAST_ACTIVITY_UPDATE_DIFF |
<p>Difference from the current <code>last_activity_at</code> attribute value before <code>updateLastSeen()</code> will update the attribute on the DB. Measured in seconds.</p> |
Properties
bool | $timestamps | <p>Indicates if the model should be timestamped. Turn off by default.</p> | from AbstractModel | |
protected callable[] | $afterSaveCallbacks | <p>An array of callbacks to be run once after the model is saved.</p> | from AbstractModel | |
protected callable[] | $afterDeleteCallbacks | <p>An array of callbacks to be run once after the model is deleted.</p> | 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 | <p>A map of access token types, as specified in the <code>type</code> column, to their classes.</p> | 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
<p>Get an attribute from the model. If nothing is found, attempt to load a custom relation method with this key.</p>
<p>Register a callback to be run once after the model is saved.</p>
<p>Register a callback to be run once after the model is deleted.</p>
<p>Generate an access token for the specified user.</p>
<p>Update the time of last usage of a token.</p>
<p>Define the relationship with the owner of this access token.</p>
<p>Filters which tokens are valid at the given date for this particular token type.</p>
<p>Filters which tokens are expired at the given date and ready for garbage collection.</p>
<p>Shortcut to find a valid token.</p>
<p>This query scope is intended to be used on the base AccessToken object to query for valid tokens of any type.</p>
<p>This query scope is intended to be used on the base AccessToken object to query for expired tokens of any type.</p>
<p>Create a new model instance according to the access token type.</p>
<p>Set the model for the given access token type.</p>
Details
in AbstractModel
at
line 65
static
boot()
<p>{@inheritdoc}</p>
in AbstractModel
at
line 85
__construct(array $attributes = [])
<p>{@inheritdoc}</p>
in AbstractModel
at
line 105
array
getDates()
<p>Get the attributes that should be converted to dates.</p>
in AbstractModel
at
line 123
mixed
getAttribute(string $key)
<p>Get an attribute from the model. If nothing is found, attempt to load a custom relation method with this key.</p>
in AbstractModel
at
line 149
protected mixed
getCustomRelation(string $name)
<p>Get a custom relation object.</p>
in AbstractModel
at
line 165
void
afterSave(callable $callback)
<p>Register a callback to be run once after the model is saved.</p>
in AbstractModel
at
line 176
void
afterDelete(callable $callback)
<p>Register a callback to be run once after the model is deleted.</p>
in AbstractModel
at
line 184
callable[]
releaseAfterSaveCallbacks()
in AbstractModel
at
line 196
callable[]
releaseAfterDeleteCallbacks()
in AbstractModel
at
line 208
__call($method, $arguments)
<p>{@inheritdoc}</p>
in AccessToken
at
line 78
static AccessToken
generate(int $userId)
<p>Generate an access token for the specified user.</p>
in AccessToken
at
line 102
bool
touch(ServerRequestInterface $request = null)
<p>Update the time of last usage of a token.</p>
<p>If a request object is provided, the IP address and User Agent will also be logged.</p>
in AccessToken
at
line 131
BelongsTo
user()
<p>Define the relationship with the owner of this access token.</p>
in AccessToken
at
line 142
static protected
scopeValid(Builder $query, Carbon $date)
<p>Filters which tokens are valid at the given date for this particular token type.</p>
<p>Uses the static::$lifetime value by default, can be overridden by children classes.</p>
in AccessToken
at
line 155
static protected
scopeExpired(Builder $query, Carbon $date)
<p>Filters which tokens are expired at the given date and ready for garbage collection.</p>
<p>Uses the static::$lifetime value by default, can be overridden by children classes.</p>
in AccessToken
at
line 169
static AccessToken|null
findValid(string $token)
<p>Shortcut to find a valid token.</p>
in AccessToken
at
line 179
scopeWhereValid(Builder $query, Carbon $date = null)
<p>This query scope is intended to be used on the base AccessToken object to query for valid tokens of any type.</p>
in AccessToken
at
line 200
scopeWhereExpired(Builder $query, Carbon $date = null)
<p>This query scope is intended to be used on the base AccessToken object to query for expired tokens of any type.</p>
in AccessToken
at
line 223
AccessToken|object
newFromBuilder(array $attributes = [], string|null $connection = null)
<p>Create a new model instance according to the access token type.</p>
in AccessToken
at
line 248
static array
getModels()
<p>Get the type-to-model map.</p>
in AccessToken
at
line 260
static void
setModel(string $type, string $model)
<p>Set the model for the given access token type.</p>