class DeveloperAccessToken extends AccessToken

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 from AccessToken
protected $casts from AccessToken
static protected $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|null $last_ip_address from AccessToken
string|null $last_user_agent from AccessToken
User|null $user from AccessToken

Methods

static 
boot()

No description

__construct(array $attributes = [])

No description

array
getCasts()

No description

getAttribute($key)

<p>Get an attribute from the model. If nothing is found, attempt to load a custom relation method with this key.</p>

mixed
getCustomRelation(string $name)

<p>Get a custom relation object.</p>

void
afterSave(callable $callback)

<p>Register a callback to be run once after the model is saved.</p>

void
afterDelete(callable $callback)

<p>Register a callback to be run once after the model is deleted.</p>

array
releaseAfterSaveCallbacks()

No description

array
releaseAfterDeleteCallbacks()

No description

__call($method, $parameters)

No description

newModelQuery()

No description

qualifyColumn($column)

No description

mixed
withTableAlias(callable $callback)

No description

newCollection(array $models = [])

No description

__sleep()

No description

static void
registerVisibilityScoper(callable $scoper, string|null $ability = null)

No description

Builder
scopeWhereVisibleTo(Builder $query, User $actor, string $ability = 'view')

<p>Scope a query to only include records that are visible to a user.</p>

static Builder
whereVisibleTo(User $user)

No description

static AccessToken
generate(int $userId)

<p>Generate an access token for the specified user.</p>

bool
touch($attribute = null, ServerRequestInterface $request = null)

<p>Update the time of last usage of a token.</p>

BelongsTo
user()

No description

static void
scopeValid(Builder $query, Carbon $date)

<p>Filters which tokens are valid at the given date for this particular token type.</p>

static void
scopeExpired(Builder $query, Carbon $date)

<p>Filters which tokens are expired at the given date and ready for garbage collection.</p>

static AccessToken|null
findValid(string $token)

<p>Shortcut to find a valid token.</p>

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>

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>

AccessToken|object
newFromBuilder(array $attributes = [], string|null $connection = null)

<p>Create a new model instance according to the access token type.</p>

static array
getModels()

<p>Get the type-to-model map.</p>

static void
setModel(string $type, string $model)

No description

Details

static boot()

__construct(array $attributes = [])

Parameters

array $attributes

array getCasts()

Return Value

array

getAttribute($key)

<p>Get an attribute from the model. If nothing is found, attempt to load a custom relation method with this key.</p>

Parameters

$key

protected mixed getCustomRelation(string $name)

<p>Get a custom relation object.</p>

Parameters

string $name

Return Value

mixed

void afterSave(callable $callback)

<p>Register a callback to be run once after the model is saved.</p>

Parameters

callable $callback

Return Value

void

void afterDelete(callable $callback)

<p>Register a callback to be run once after the model is deleted.</p>

Parameters

callable $callback

Return Value

void

array releaseAfterSaveCallbacks()

Return Value

array

array releaseAfterDeleteCallbacks()

Return Value

array

__call($method, $parameters)

Parameters

$method
$parameters

newModelQuery()

qualifyColumn($column)

Parameters

$column

mixed withTableAlias(callable $callback)

Parameters

callable $callback

Return Value

mixed

Collection newCollection(array $models = [])

Parameters

array $models

Return Value

Collection

__sleep()

static void registerVisibilityScoper(callable $scoper, string|null $ability = null)

Parameters

callable $scoper
string|null $ability

Return Value

void

Builder scopeWhereVisibleTo(Builder $query, User $actor, string $ability = 'view')

<p>Scope a query to only include records that are visible to a user.</p>

Parameters

Builder $query
User $actor
string $ability

Return Value

Builder

static Builder whereVisibleTo(User $user)

Parameters

User $user

Return Value

Builder

static AccessToken generate(int $userId)

<p>Generate an access token for the specified user.</p>

Parameters

int $userId

Return Value

AccessToken

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>

Parameters

$attribute
ServerRequestInterface $request

Return Value

bool

BelongsTo user()

Return Value

BelongsTo

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>

Parameters

Builder $query
Carbon $date

Return Value

void

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>

Parameters

Builder $query
Carbon $date

Return Value

void

static AccessToken|null findValid(string $token)

<p>Shortcut to find a valid token.</p>

Parameters

string $token <p>Token as sent by the user. We allow non-string values like null so we can directly feed any value from a request.</p>

Return Value

AccessToken|null

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>

Parameters

Builder $query
Carbon|null $date

Return Value

void

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>

Parameters

Builder $query
Carbon $date

Return Value

void

AccessToken|object newFromBuilder(array $attributes = [], string|null $connection = null)

<p>Create a new model instance according to the access token type.</p>

Parameters

array $attributes
string|null $connection

Return Value

AccessToken|object

static array getModels()

<p>Get the type-to-model map.</p>

Return Value

array

static void setModel(string $type, string $model)

Parameters

string $type
string $model

Return Value

void