Queue
extends Model
in package
implements
QueueStorageInterface
Uses
Uuid, Find, Status, OptionsAttribute, UserRelation, DateCreated
Queue database model
Table of Contents
Interfaces
- QueueStorageInterface
- Job recuring interface
Properties
- $ACTIVE : mixed
- Active
- $appends : array<string|int, mixed>
- Append custom attributes
- $CANCELLED : mixed
- Cancelled
- $COMPLETED : mixed
- Completed
- $DISABLED : mixed
- Disabled
- $PENDING : mixed
- Pending activation
- $PUBLISHED : mixed
- Published
- $SUSPENDED : mixed
- Suspended
- $timestamps : bool
- Disable timestamps
- $DEFAULT_STATUS_COLUMN : string
- Default status column name
- $DEFAULT_USER_COLUMN : string
- Default user column name
- $DEFAULT_UUID_COLUMN : string
- Default uuid column name
- $fillable : array<string|int, mixed>
- Fillable attributes
- $optionsColumnName : string
- Options column name
- $statusText : array<string|int, mixed>
- Status text
- $table : string
- Db table name
Methods
- ACTIVE() : int
- Return active value
- addJob() : bool
- Add job
- bootDateCreated() : void
- Set model events
- bootUserRelation() : void
- Init model events.
- bootUuid() : void
- Init model events.
- CANCELLED() : int
- Cancelled
- COMPLETED() : int
- Return completed value
- deleteJob() : bool
- Delete job
- deleteJobs() : bool
- Delete jobs
- 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
- Get current auth id
- getDateCreatedAttributeName() : string
- Get date created attribute
- getDisabled() : Builder
- Return disabled model query builder
- getDueDateAttribute() : int|null
- Get attribute mutator for due_date
- getIdAttributeName() : string
- Return id column name dependiv of id value type for string return uuid
- getJob() : array<string|int, mixed>|null
- Get job
- getJobId() : string|false
- Find job and return job id
- getJobs() : array<string|int, mixed>
- Get jobs
- getJobsDue() : array<string|int, mixed>|null
- Get all jobs due or filter by name
- getJobsDueQuery() : Builder
- Get jobs due query
- getLastId() : int|null
- Get last id
- getLastRow() : Model|null
- Get last row
- getNext() : array<string|int, mixed>|null
- Get next Job
- getOption() : mixed
- Get option from options array
- getOptionsAttribute() : array<string|int, mixed>
- Mutator (get) for options attribute.
- getOptionsColumnName() : string
- Get options column name
- hasAttribute() : bool
- Return true if atr exist
- hasJob() : bool
- Return true if job exists
- isRecurring() : bool
- Return true if job is recurring
- isScheduled() : bool
- Return true if job is scheduled
- PENDING() : int
- Pending activation
- resolveStatusText() : int|false
- Resolve status id
- resolveStatusValue() : int
- Get status value
- saveJobConfigParam() : bool
- Update job config param
- saveOption() : bool
- Save option
- saveOptions() : bool
- Save options
- scopeActiveQuery() : Builder
- Active status scope
- scopeSearchIgnoreCase() : Builder
- Case insensitive search
- scopeStatusQuery() : Builder
- Status scope
- scopeUserQuery() : Builder
- Filter by user
- scopeUserQueryWithPublic() : Builder
- Filter rows by user + null (public)
- setJobStatus() : bool
- Update execution status
- setStatus() : bool
- Set model status
- SUSPENDED() : int
- Suspended
- updateExecutionStatus() : bool
- Update execution status
- user() : Relation|null
- Get user relation
- whereIgnoreCase() : Builder
- Where case insensitive
Properties
$ACTIVE
Active
public
static mixed
$ACTIVE
= 1
$appends
Append custom attributes
public
array<string|int, mixed>
$appends
= ['due_date', 'options']
$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
$DEFAULT_STATUS_COLUMN
Default status column name
protected
static string
$DEFAULT_STATUS_COLUMN
= 'status'
$DEFAULT_USER_COLUMN
Default user column name
protected
static string
$DEFAULT_USER_COLUMN
= 'user_id'
$DEFAULT_UUID_COLUMN
Default uuid column name
protected
static string
$DEFAULT_UUID_COLUMN
= 'uuid'
$fillable
Fillable attributes
protected
array<string|int, mixed>
$fillable
= ['name', 'priority', 'recuring_interval', 'handler_class', 'status', 'user_id', 'extension_name', 'schedule_time', 'date_created', 'date_executed', 'executed', 'config', 'type', 'service_name', 'queue']
$optionsColumnName
Options column name
protected
string
$optionsColumnName
= 'config'
$statusText
Status text
protected
array<string|int, mixed>
$statusText
= ['disabled', 'active', 'completed', 'published', 'pending', 'suspended', 'cancelled']
$table
Db table name
protected
string
$table
= 'queue'
Methods
ACTIVE()
Return active value
public
ACTIVE() : int
Return values
intaddJob()
Add job
public
addJob(array<string|int, mixed> $data) : bool
Parameters
- $data : array<string|int, mixed>
Return values
boolbootDateCreated()
Set model events
public
static bootDateCreated() : void
bootUserRelation()
Init model events.
public
static bootUserRelation() : void
bootUuid()
Init model events.
public
static bootUuid() : void
CANCELLED()
Cancelled
public
CANCELLED() : int
Return values
intCOMPLETED()
Return completed value
public
COMPLETED() : int
Return values
intdeleteJob()
Delete job
public
deleteJob(string|int $id) : bool
Parameters
- $id : string|int
Return values
booldeleteJobs()
Delete jobs
public
deleteJobs([array<string|int, mixed> $filter = [] ]) : bool
Parameters
- $filter : array<string|int, mixed> = []
Return values
boolDISABLED()
Return disabled value
public
DISABLED() : int
Return values
intfindByColumn()
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|nullfindById()
Find model by id or uuid
public
findById(int|string $id) : Model|null
Parameters
- $id : int|string
Return values
Model|nullfindByIdQuery()
Return query builder
public
findByIdQuery(int|string $id) : Builder
Parameters
- $id : int|string
Return values
BuilderfindItems()
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|falsefindMultiple()
Find multiole query
public
findMultiple(array<string|int, mixed> $idList) : Builder
Parameters
- $idList : array<string|int, mixed>
Return values
BuilderfindQuery()
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
BuildergetActive()
Return active model query builder
public
getActive() : Builder
Return values
BuildergetAuthId()
Get current auth id
public
getAuthId() : mixed
getDateCreatedAttributeName()
Get date created attribute
public
getDateCreatedAttributeName() : string
Return values
stringgetDisabled()
Return disabled model query builder
public
getDisabled() : Builder
Return values
BuildergetDueDateAttribute()
Get attribute mutator for due_date
public
getDueDateAttribute() : int|null
Return values
int|nullgetIdAttributeName()
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
stringgetJob()
Get job
public
getJob(string|int $id) : array<string|int, mixed>|null
Parameters
- $id : string|int
-
Job id or uiid
Return values
array<string|int, mixed>|nullgetJobId()
Find job and return job id
public
getJobId([array<string|int, mixed> $filter = [] ]) : string|false
Parameters
- $filter : array<string|int, mixed> = []
Return values
string|falsegetJobs()
Get jobs
public
getJobs([array<string|int, mixed> $filter = [] ]) : array<string|int, mixed>
Parameters
- $filter : array<string|int, mixed> = []
Return values
array<string|int, mixed>getJobsDue()
Get all jobs due or filter by name
public
getJobsDue([string|null $jobName = null ]) : array<string|int, mixed>|null
Parameters
- $jobName : string|null = null
Return values
array<string|int, mixed>|nullgetJobsDueQuery()
Get jobs due query
public
getJobsDueQuery([string|null $jobName = null ]) : Builder
Parameters
- $jobName : string|null = null
Return values
BuildergetLastId()
Get last id
public
getLastId() : int|null
Return values
int|nullgetLastRow()
Get last row
public
getLastRow([string $field = 'id' ]) : Model|null
Parameters
- $field : string = 'id'
Return values
Model|nullgetNext()
Get next Job
public
getNext() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullgetOption()
Get option from options array
public
getOption(string $key[, mixed $default = null ]) : mixed
Parameters
- $key : string
- $default : mixed = null
getOptionsAttribute()
Mutator (get) for options attribute.
public
getOptionsAttribute() : array<string|int, mixed>
Return values
array<string|int, mixed>getOptionsColumnName()
Get options column name
public
getOptionsColumnName() : string
Return values
stringhasAttribute()
Return true if atr exist
public
hasAttribute(string $attr) : bool
Parameters
- $attr : string
Return values
boolhasJob()
Return true if job exists
public
hasJob(string|int $id) : bool
Parameters
- $id : string|int
-
Job id, uiid
Return values
boolisRecurring()
Return true if job is recurring
public
isRecurring() : bool
Return values
boolisScheduled()
Return true if job is scheduled
public
isScheduled() : bool
Return values
boolPENDING()
Pending activation
public
PENDING() : int
Return values
intresolveStatusText()
Resolve status id
public
resolveStatusText(string|int $status) : int|false
Parameters
- $status : string|int
Return values
int|falseresolveStatusValue()
Get status value
public
resolveStatusValue([int|null|string $status = null ]) : int
Parameters
- $status : int|null|string = null
Return values
intsaveJobConfigParam()
Update job config param
public
saveJobConfigParam(string|int $id, string $key, mixed $value) : bool
Parameters
- $id : string|int
-
Job id
- $key : string
- $value : mixed
Return values
boolsaveOption()
Save option
public
saveOption(string $key, mixed $value) : bool
Parameters
- $key : string
- $value : mixed
Return values
boolsaveOptions()
Save options
public
saveOptions(array<string|int, mixed> $options) : bool
Parameters
- $options : array<string|int, mixed>
Return values
boolscopeActiveQuery()
Active status scope
public
scopeActiveQuery(Builder $query) : Builder
Parameters
- $query : Builder
Return values
BuilderscopeSearchIgnoreCase()
Case insensitive search
public
scopeSearchIgnoreCase(Builder $query, string $column, string|null $value) : Builder
Parameters
- $query : Builder
- $column : string
- $value : string|null
Return values
BuilderscopeStatusQuery()
Status scope
public
scopeStatusQuery(Builder $query, mixed $items) : Builder
Parameters
- $query : Builder
- $items : mixed
Return values
BuilderscopeUserQuery()
Filter by user
public
scopeUserQuery(Builder $query, int|null $userId) : Builder
Parameters
- $query : Builder
- $userId : int|null
Return values
BuilderscopeUserQueryWithPublic()
Filter rows by user + null (public)
public
scopeUserQueryWithPublic(Builder $query, int|null $userId) : Builder
Parameters
- $query : Builder
- $userId : int|null
Return values
BuildersetJobStatus()
Update execution status
public
setJobStatus(string|int $id, int $status) : bool
Parameters
- $id : string|int
- $status : int
Return values
boolsetStatus()
Set model status
public
setStatus([int|string|null $status = null ]) : bool
Parameters
- $status : int|string|null = null
Return values
boolSUSPENDED()
Suspended
public
SUSPENDED() : int
Return values
intupdateExecutionStatus()
Update execution status
public
updateExecutionStatus(JobInterface $job) : bool
Parameters
- $job : JobInterface
Return values
booluser()
Get user relation
public
user() : Relation|null
Return values
Relation|nullwhereIgnoreCase()
Where case insensitive
public
whereIgnoreCase(string $attribute, mixed $value[, string $operator = '=' ]) : Builder
Parameters
- $attribute : string
- $value : mixed
- $operator : string = '='