class AccessToken extends AbstractModel
Traits
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 | $customCasts | from AbstractModel | ||
static | $defaults | from AbstractModel | ||
protected | $tableAlias | <p>An alias for the table name, used in queries.</p> | from AbstractModel | |
static protected | $visibilityScopers | from ScopeVisibilityTrait | ||
protected | $table | |||
protected | $casts | |||
static protected | $models | <p>A map of access token types, as specified in the <code>type</code> column, to their classes.</p> | ||
string | $type | |||
static protected int | $lifetime | <p>How long this access token should be valid from the time of last activity.</p> | ||
int | $id | |||
string | $token | |||
int | $user_id | |||
Carbon | $created_at | |||
Carbon|null | $last_activity_at | |||
string | $title | |||
string|null | $last_ip_address | |||
string|null | $last_user_agent | |||
User|null | $user |
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>
No description
<p>Scope a query to only include records that are visible to a user.</p>
<p>Update the time of last usage of a 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>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>
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 118
getAttribute($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 143
protected mixed
getCustomRelation(string $name)
<p>Get a custom relation object.</p>
in AbstractModel
at
line 158
void
afterSave(callable $callback)
<p>Register a callback to be run once after the model is saved.</p>
in AbstractModel
at
line 166
void
afterDelete(callable $callback)
<p>Register a callback to be run once after the model is deleted.</p>
in AbstractModel
at
line 174
array
releaseAfterSaveCallbacks()
in AbstractModel
at
line 186
array
releaseAfterDeleteCallbacks()
in AbstractModel
at
line 195
__call($method, $parameters)
in AbstractModel
at
line 204
newModelQuery()
in AbstractModel
at
line 215
qualifyColumn($column)
in AbstractModel
at
line 224
mixed
withTableAlias(callable $callback)
in AbstractModel
at
line 236
Collection
newCollection(array $models = [])
in AbstractModel
at
line 241
__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')
<p>Scope a query to only include records that are visible to a user.</p>
in ScopeVisibilityTrait
at
line 19
static Builder
whereVisibleTo(User $user)
at
line 77
static AccessToken
generate(int $userId)
<p>Generate an access token for the specified user.</p>
at
line 99
bool
touch($attribute = null, 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>
at
line 124
BelongsTo
user()
at
line 133
static protected void
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>
at
line 144
static protected void
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>
at
line 157
static AccessToken|null
findValid(string $token)
<p>Shortcut to find a valid token.</p>
at
line 165
void
scopeWhereValid(Builder $query, Carbon|null $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>
at
line 184
void
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>
at
line 207
AccessToken|object
newFromBuilder(array $attributes = [], string|null $connection = null)
<p>Create a new model instance according to the access token type.</p>
at
line 230
static array
getModels()
<p>Get the type-to-model map.</p>