Arikaim CMS

AccessTokens extends Model
in package
implements UserProviderInterface Uses Uuid, Find, Status, Auth, DateCreated

Access tokens database model

Table of Contents

Interfaces

UserProviderInterface
User auth interface

Properties

$ACTIVE  : mixed
Active
$CANCELLED  : mixed
Cancelled
$COMPLETED  : mixed
Completed
$DISABLED  : mixed
Disabled
$PENDING  : mixed
Pending activation
$PUBLISHED  : mixed
Published
$SUSPENDED  : mixed
Suspended
$timestamps  : bool
Disable timestamps
$authIdColumn  : string
Auth id column name
$DEFAULT_STATUS_COLUMN  : string
Default status column name
$DEFAULT_UUID_COLUMN  : string
Default uuid column name
$fillable  : array<string|int, mixed>
Fillable attributes
$statusText  : array<string|int, mixed>
Status text
$table  : string
Db table name

Methods

ACTIVE()  : int
Return active value
bootDateCreated()  : void
Set model events
bootUuid()  : void
Init model events.
CANCELLED()  : int
Cancelled
COMPLETED()  : int
Return completed value
createToken()  : array<string|int, mixed>|false
Create access token
deleteExpired()  : bool
Delete expired token
deleteExpiredTokens()  : bool
Delete all expired tokens
deleteUserToken()  : bool
Delete user token
DISABLED()  : int
Return disabled value
findByColumn()  : Model|null
Find model by column name
findById()  : Model|null
Find model by id or uuid
findByIdQuery()  : Builder
Return query builder
findItems()  : QueryBuilder|false
Find collection of models by id or uuid
findMultiple()  : Builder
Find multiole query
findQuery()  : Builder
Return query builder
getActive()  : Builder
Return active model query builder
getAuthId()  : mixed
Return auth id
getAuthIdName()  : string
Return Auth id name
getDateCreatedAttributeName()  : string
Get date created attribute
getDisabled()  : Builder
Return disabled model query builder
getExpiredAttribute()  : bool
Expired mutator attribute
getIdAttributeName()  : string
Return id column name dependiv of id value type for string return uuid
getLastId()  : int|null
Get last id
getLastRow()  : Model|null
Get last row
getToken()  : Model|null
Get access token
getTokenByUser()  : Model|null
Find token
getType()  : int|null
Get token type
getUserByCredentials()  : array<string|int, mixed>|null
Get user credentials
getUserById()  : array<string|int, mixed>|null
Return user details by auth id
getUserTokens()  : null|Collection
Get all tokens for user
hasAttribute()  : bool
Return true if atr exist
hasToken()  : bool
Return true if token exist
isExpired()  : bool
Return true if token is expired
PENDING()  : int
Pending activation
removeToken()  : bool
Remove access token
resolveStatusText()  : int|false
Resolve status id
resolveStatusValue()  : int
Get status value
scopeActiveQuery()  : Builder
Active status scope
scopeSearchIgnoreCase()  : Builder
Case insensitive search
scopeStatusQuery()  : Builder
Status scope
setStatus()  : bool
Set model status
SUSPENDED()  : int
Suspended
user()  : Relation|null
User relation
verifyPassword()  : bool
Return true token is correct.
whereIgnoreCase()  : Builder
Where case insensitive

Properties

$ACTIVE

Active

public static mixed $ACTIVE = 1

$CANCELLED

Cancelled

public static mixed $CANCELLED = 6

$COMPLETED

Completed

public static mixed $COMPLETED = 2

$DISABLED

Disabled

public static mixed $DISABLED = 0

$PENDING

Pending activation

public static mixed $PENDING = 4

$PUBLISHED

Published

public static mixed $PUBLISHED = 3

$SUSPENDED

Suspended

public static mixed $SUSPENDED = 5

$timestamps

Disable timestamps

public bool $timestamps = false

$authIdColumn

Auth id column name

protected string $authIdColumn = 'user_id'

$DEFAULT_STATUS_COLUMN

Default status column name

protected static string $DEFAULT_STATUS_COLUMN = 'status'

$DEFAULT_UUID_COLUMN

Default uuid column name

protected static string $DEFAULT_UUID_COLUMN = 'uuid'

$fillable

Fillable attributes

protected array<string|int, mixed> $fillable = ['token', 'date_expired', 'user_id', 'type']

$statusText

Status text

protected array<string|int, mixed> $statusText = ['disabled', 'active', 'completed', 'published', 'pending', 'suspended', 'cancelled']

$table

Db table name

protected string $table = 'access_tokens'

Methods

ACTIVE()

Return active value

public ACTIVE() : int
Return values
int

bootDateCreated()

Set model events

public static bootDateCreated() : void

bootUuid()

Init model events.

public static bootUuid() : void

CANCELLED()

Cancelled

public CANCELLED() : int
Return values
int

COMPLETED()

Return completed value

public COMPLETED() : int
Return values
int

createToken()

Create access token

public createToken(int $userId[, int $type = AuthTokensInterface::PAGE_ACCESS_TOKEN ][, int $expireTime = 1800 ][, bool $deleteExpired = true ]) : array<string|int, mixed>|false
Parameters
$userId : int
$type : int = AuthTokensInterface::PAGE_ACCESS_TOKEN
$expireTime : int = 1800
$deleteExpired : bool = true
Return values
array<string|int, mixed>|false

deleteExpired()

Delete expired token

public deleteExpired(int $userId[, int|null $type = null ]) : bool
Parameters
$userId : int
$type : int|null = null
Return values
bool

deleteExpiredTokens()

Delete all expired tokens

public deleteExpiredTokens() : bool
Return values
bool

deleteUserToken()

Delete user token

public deleteUserToken(int $userId[, int|null $type = AuthTokensInterface::PAGE_ACCESS_TOKEN ]) : bool
Parameters
$userId : int
$type : int|null = AuthTokensInterface::PAGE_ACCESS_TOKEN
Return values
bool

DISABLED()

Return disabled value

public DISABLED() : int
Return values
int

findByColumn()

Find model by column name

public findByColumn(mixed $value[, string|null|array<string|int, mixed> $column = null ]) : Model|null
Parameters
$value : mixed
$column : string|null|array<string|int, mixed> = null
Return values
Model|null

findById()

Find model by id or uuid

public findById(int|string $id) : Model|null
Parameters
$id : int|string
Return values
Model|null

findByIdQuery()

Return query builder

public findByIdQuery(int|string $id) : Builder
Parameters
$id : int|string
Return values
Builder

findItems()

Find collection of models by id or uuid

public findItems(array<string|int, mixed>|null $items) : QueryBuilder|false
Parameters
$items : array<string|int, mixed>|null
Return values
QueryBuilder|false

findMultiple()

Find multiole query

public findMultiple(array<string|int, mixed> $idList) : Builder
Parameters
$idList : array<string|int, mixed>
Return values
Builder

findQuery()

Return query builder

public findQuery(mixed $value[, string|null|array<string|int, mixed> $column = null ]) : Builder
Parameters
$value : mixed
$column : string|null|array<string|int, mixed> = null
Return values
Builder

getActive()

Return active model query builder

public getActive() : Builder
Return values
Builder

getAuthId()

Return auth id

public getAuthId() : mixed

getAuthIdName()

Return Auth id name

public getAuthIdName() : string
Return values
string

getDateCreatedAttributeName()

Get date created attribute

public getDateCreatedAttributeName() : string
Return values
string

getDisabled()

Return disabled model query builder

public getDisabled() : Builder
Return values
Builder

getExpiredAttribute()

Expired mutator attribute

public getExpiredAttribute() : bool
Return values
bool

getIdAttributeName()

Return id column name dependiv of id value type for string return uuid

public getIdAttributeName(int|string $id) : string
Parameters
$id : int|string
Return values
string

getLastId()

Get last id

public getLastId() : int|null
Return values
int|null

getLastRow()

Get last row

public getLastRow([string $field = 'id' ]) : Model|null
Parameters
$field : string = 'id'
Return values
Model|null

getToken()

Get access token

public getToken(string $token) : Model|null
Parameters
$token : string
Return values
Model|null

getTokenByUser()

Find token

public getTokenByUser(int $userId[, int $type = AuthTokensInterface::PAGE_ACCESS_TOKEN ]) : Model|null
Parameters
$userId : int
$type : int = AuthTokensInterface::PAGE_ACCESS_TOKEN
Return values
Model|null

getType()

Get token type

public getType(string $token) : int|null
Parameters
$token : string
Return values
int|null

getUserByCredentials()

Get user credentials

public getUserByCredentials(array<string|int, mixed> $credentials) : array<string|int, mixed>|null
Parameters
$credentials : array<string|int, mixed>
Return values
array<string|int, mixed>|null

getUserById()

Return user details by auth id

public getUserById(string|int $id) : array<string|int, mixed>|null
Parameters
$id : string|int
Return values
array<string|int, mixed>|null

getUserTokens()

Get all tokens for user

public getUserTokens(int $userId) : null|Collection
Parameters
$userId : int
Return values
null|Collection

hasAttribute()

Return true if atr exist

public hasAttribute(string $attr) : bool
Parameters
$attr : string
Return values
bool

hasToken()

Return true if token exist

public hasToken(int $userId[, int $type = AuthTokensInterface::PAGE_ACCESS_TOKEN ]) : bool
Parameters
$userId : int
$type : int = AuthTokensInterface::PAGE_ACCESS_TOKEN
Return values
bool

isExpired()

Return true if token is expired

public isExpired([string|null $token = null ]) : bool
Parameters
$token : string|null = null
Return values
bool

PENDING()

Pending activation

public PENDING() : int
Return values
int

removeToken()

Remove access token

public removeToken(string $token) : bool
Parameters
$token : string
Return values
bool

resolveStatusText()

Resolve status id

public resolveStatusText(string|int $status) : int|false
Parameters
$status : string|int
Return values
int|false

resolveStatusValue()

Get status value

public resolveStatusValue([int|null|string $status = null ]) : int
Parameters
$status : int|null|string = null
Return values
int

scopeActiveQuery()

Active status scope

public scopeActiveQuery(Builder $query) : Builder
Parameters
$query : Builder
Return values
Builder

scopeSearchIgnoreCase()

Case insensitive search

public scopeSearchIgnoreCase(Builder $query, string $column, string|null $value) : Builder
Parameters
$query : Builder
$column : string
$value : string|null
Return values
Builder

scopeStatusQuery()

Status scope

public scopeStatusQuery(Builder $query, mixed $items) : Builder
Parameters
$query : Builder
$items : mixed
Return values
Builder

setStatus()

Set model status

public setStatus([int|string|null $status = null ]) : bool
Parameters
$status : int|string|null = null
Return values
bool

SUSPENDED()

Suspended

public SUSPENDED() : int
Return values
int

user()

User relation

public user() : Relation|null
Return values
Relation|null

verifyPassword()

Return true token is correct.

public verifyPassword(string $password) : bool
Parameters
$password : string
Return values
bool

whereIgnoreCase()

Where case insensitive

public whereIgnoreCase(string $attribute, mixed $value[, string $operator = '=' ]) : Builder
Parameters
$attribute : string
$value : mixed
$operator : string = '='
Return values
Builder

        
On this page

Search results