EventSubscribers
extends Model
in package
implements
SubscriberRegistryInterface
Uses
Uuid, Find, Status
EventSubscribers database model
Table of Contents
Interfaces
- SubscriberRegistryInterface
- Subscriber Registry 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
- $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
- addSubscriber() : bool
- Save subscriber info to db table.
- bootUuid() : void
- Init model events.
- CANCELLED() : int
- Cancelled
- COMPLETED() : int
- Return completed value
- deleteSubscribers() : bool
- Delete subscribers.
- DISABLED() : int
- Return disabled value
- disableExtensionSubscribers() : bool
- Disable extension subscribers.
- disableSubscribers() : bool
- Disable all subscribers for event.
- enableExtensionSubscribers() : bool
- Enable extension subscribers.
- enableSubscribers() : bool
- Enable all subscribers for event.
- 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
- getDisabled() : Builder
- Return disabled model query builder
- 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
- getSubscribers() : array<string|int, mixed>
- Get subscribers list
- getSubscribersQuery() : Builder
- Return subscribers query builder
- hasAttribute() : bool
- Return true if atr exist
- hasSubscriber() : bool
- Return true if event have subscriber(s)
- PENDING() : int
- Pending activation
- 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
- scopeSubscribers() : Builder
- Subscribers scope query
- setStatus() : bool
- Set model status
- SUSPENDED() : int
- Suspended
- whereIgnoreCase() : Builder
- Where case insensitive
- changeStatus() : bool
- Change subscriber status
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
$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
= ['uuid', 'name', 'handler_class', 'handler_method', 'extension_name', 'priority']
$statusText
Status text
protected
array<string|int, mixed>
$statusText
= ['disabled', 'active', 'completed', 'published', 'pending', 'suspended', 'cancelled']
$table
Db table name
protected
string
$table
= 'event_subscribers'
Methods
ACTIVE()
Return active value
public
ACTIVE() : int
Return values
intaddSubscriber()
Save subscriber info to db table.
public
addSubscriber(string $eventName, string $class[, string|null $extension = null ][, int $priority = 0 ][, string|null $hadnlerMethod = null ]) : bool
Parameters
- $eventName : string
- $class : string
- $extension : string|null = null
- $priority : int = 0
- $hadnlerMethod : string|null = null
Return values
boolbootUuid()
Init model events.
public
static bootUuid() : void
CANCELLED()
Cancelled
public
CANCELLED() : int
Return values
intCOMPLETED()
Return completed value
public
COMPLETED() : int
Return values
intdeleteSubscribers()
Delete subscribers.
public
deleteSubscribers(array<string|int, mixed> $filter) : bool
Parameters
- $filter : array<string|int, mixed>
Return values
boolDISABLED()
Return disabled value
public
DISABLED() : int
Return values
intdisableExtensionSubscribers()
Disable extension subscribers.
public
disableExtensionSubscribers(string $extension) : bool
Parameters
- $extension : string
Return values
booldisableSubscribers()
Disable all subscribers for event.
public
disableSubscribers(string|null $eventName[, string|null $extension = null ]) : bool
Parameters
- $eventName : string|null
- $extension : string|null = null
Return values
boolenableExtensionSubscribers()
Enable extension subscribers.
public
enableExtensionSubscribers(string $extension) : bool
Parameters
- $extension : string
Return values
boolenableSubscribers()
Enable all subscribers for event.
public
enableSubscribers(string|null $eventName[, string|null $extension = null ]) : bool
Parameters
- $eventName : string|null
- $extension : string|null = null
Return values
boolfindByColumn()
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
BuildergetDisabled()
Return disabled model query builder
public
getDisabled() : Builder
Return values
BuildergetIdAttributeName()
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
stringgetLastId()
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|nullgetSubscribers()
Get subscribers list
public
getSubscribers([string|null $eventName = null ][, string|null $extensionName = null ][, int|null $status = null ]) : array<string|int, mixed>
Parameters
- $eventName : string|null = null
- $extensionName : string|null = null
- $status : int|null = null
Return values
array<string|int, mixed>getSubscribersQuery()
Return subscribers query builder
public
getSubscribersQuery(string $eventName, string|null $extension) : Builder
Parameters
- $eventName : string
- $extension : string|null
Return values
BuilderhasAttribute()
Return true if atr exist
public
hasAttribute(string $attr) : bool
Parameters
- $attr : string
Return values
boolhasSubscriber()
Return true if event have subscriber(s)
public
hasSubscriber(string $eventName, string|null $extension) : bool
Parameters
- $eventName : string
- $extension : string|null
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
intscopeActiveQuery()
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
BuilderscopeSubscribers()
Subscribers scope query
public
scopeSubscribers(Builder $query[, string|null $eventName = null ][, string|null $extensionName = null ][, int|null $status = null ]) : Builder
Parameters
- $query : Builder
- $eventName : string|null = null
- $extensionName : string|null = null
- $status : int|null = null
Return values
BuildersetStatus()
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
intwhereIgnoreCase()
Where case insensitive
public
whereIgnoreCase(string $attribute, mixed $value[, string $operator = '=' ]) : Builder
Parameters
- $attribute : string
- $value : mixed
- $operator : string = '='
Return values
BuilderchangeStatus()
Change subscriber status
private
changeStatus([string|null $eventName = null ][, string|null $extension = null ][, int $status = 1 ]) : bool
Parameters
- $eventName : string|null = null
- $extension : string|null = null
- $status : int = 1