Routes
extends Model
in package
implements
RoutesStorageInterface
Uses
Uuid, Find, Status
Routes database model
Table of Contents
Interfaces
- RoutesStorageInterface
- Routes storage 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
- $appends : array<string|int, mixed>
- Append attribute
- $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
- addMiddleware() : bool
- Add route middleware
- addRoute() : bool
- Add route
- bootUuid() : void
- Init model events.
- CANCELLED() : int
- Cancelled
- COMPLETED() : int
- Return completed value
- deleteRoute() : bool
- Delete route
- deleteRoutes() : bool
- Delete routes
- 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
- getDisabled() : Builder
- Return disabled model query builder
- getHomePageRoute() : array<string|int, mixed>
- Get home page route
- 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
- getMiddlewareAttribute() : array<string|int, mixed>
- Mutator (get) for middlewares attribute.
- getRoute() : array<string|int, mixed>|false
- Get route
- getRouteDetails() : array<string|int, mixed>|null
- Get route details
- getRoutes() : array<string|int, mixed>
- Get routes
- hasAttribute() : bool
- Return true if atr exist
- hasRoute() : bool
- Return true if reoute exists
- isValid() : bool
- Return true if route info is valid
- PENDING() : int
- Pending activation
- resolveStatusText() : int|false
- Resolve status id
- resolveStatusValue() : int
- Get status value
- saveRedirectUrl() : bool
- Save route redirect url
- saveRouteOptions() : bool
- Save route options
- scopeActiveQuery() : Builder
- Active status scope
- scopeSearchIgnoreCase() : Builder
- Case insensitive search
- scopeStatusQuery() : Builder
- Status scope
- searchRoutes() : array<string|int, mixed>
- Get routes list for request method
- setOptionsAttribute() : void
- Mutator (set) for options attribute.
- setRoutesStatus() : bool
- Set routes status
- setStatus() : bool
- Set model status
- SUSPENDED() : int
- Suspended
- 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
$appends
Append attribute
protected
array<string|int, mixed>
$appends
= ['middleware']
$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', 'pattern', 'method', 'handler_class', 'handler_method', 'extension_name', 'redirect_url', 'auth', 'type', 'status', 'template_name', 'options', 'regex', 'middlewares', 'page_name']
$statusText
Status text
protected
array<string|int, mixed>
$statusText
= ['disabled', 'active', 'completed', 'published', 'pending', 'suspended', 'cancelled']
$table
Db table name
protected
string
$table
= 'routes'
Methods
ACTIVE()
Return active value
public
ACTIVE() : int
Return values
intaddMiddleware()
Add route middleware
public
addMiddleware(string $method, string $pattern, string $middlewareClass) : bool
Parameters
- $method : string
- $pattern : string
- $middlewareClass : string
Return values
booladdRoute()
Add route
public
addRoute(array<string|int, mixed> $route) : bool
Parameters
- $route : array<string|int, mixed>
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
intdeleteRoute()
Delete route
public
deleteRoute(string $method, string $pattern) : bool
Parameters
- $method : string
- $pattern : string
Return values
booldeleteRoutes()
Delete routes
public
deleteRoutes([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
BuildergetDisabled()
Return disabled model query builder
public
getDisabled() : Builder
Return values
BuildergetHomePageRoute()
Get home page route
public
getHomePageRoute() : array<string|int, mixed>
Return values
array<string|int, mixed>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
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|nullgetMiddlewareAttribute()
Mutator (get) for middlewares attribute.
public
getMiddlewareAttribute() : array<string|int, mixed>
Return values
array<string|int, mixed>getRoute()
Get route
public
getRoute(string $method, string $pattern) : array<string|int, mixed>|false
Parameters
- $method : string
- $pattern : string
Return values
array<string|int, mixed>|falsegetRouteDetails()
Get route details
public
getRouteDetails(string|int $id) : array<string|int, mixed>|null
Parameters
- $id : string|int
-
Route id or uuid
Return values
array<string|int, mixed>|nullgetRoutes()
Get routes
public
getRoutes([array<string|int, mixed> $filter = [] ]) : array<string|int, mixed>
Parameters
- $filter : array<string|int, mixed> = []
Return values
array<string|int, mixed>hasAttribute()
Return true if atr exist
public
hasAttribute(string $attr) : bool
Parameters
- $attr : string
Return values
boolhasRoute()
Return true if reoute exists
public
hasRoute(string $method, string $pattern) : bool
Parameters
- $method : string
- $pattern : string
Return values
boolisValid()
Return true if route info is valid
public
isValid(array<string|int, mixed> $routeInfo) : bool
Parameters
- $routeInfo : array<string|int, mixed>
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
intsaveRedirectUrl()
Save route redirect url
public
saveRedirectUrl(string $method, string $pattern, string $url) : bool
Parameters
- $method : string
- $pattern : string
- $url : string
Return values
boolsaveRouteOptions()
Save route options
public
saveRouteOptions(string $method, string $pattern, array<string|int, mixed> $options) : bool
Parameters
- $method : string
- $pattern : string
- $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
BuildersearchRoutes()
Get routes list for request method
public
searchRoutes(string $method[, int|null $type = null ]) : array<string|int, mixed>
Parameters
- $method : string
- $type : int|null = null
Return values
array<string|int, mixed>setOptionsAttribute()
Mutator (set) for options attribute.
public
setOptionsAttribute(array<string|int, mixed>|null $value) : void
Parameters
- $value : array<string|int, mixed>|null
setRoutesStatus()
Set routes status
public
setRoutesStatus(array<string|int, mixed> $filter, int $status) : bool
Parameters
- $filter : array<string|int, mixed>
- $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
intwhereIgnoreCase()
Where case insensitive
public
whereIgnoreCase(string $attribute, mixed $value[, string $operator = '=' ]) : Builder
Parameters
- $attribute : string
- $value : mixed
- $operator : string = '='