Arikaim CMS

Crud

CRUD trait

Table of Contents

Properties

$afterCreateCallback  : Closure|null
After create
$afterDeleteCallback  : Closure|null
After delete
$afterUpdateCallback  : Closure|null
After update
$beforeCreateCallback  : Closure|null
Before create
$beforeDeleteCallback  : Closure|null
Before delete
$beforeReadCallback  : Closure|null
Before read
$beforeUpdateCallback  : Closure|null
Before update

Methods

create()  : ResponseInterface
Create model
deleteController()  : ResponseInterface
Delete model
read()  : ResponseInterface
Read model
update()  : ResponseInterface
Update model
applyDefaultValues()  : mixed
Apply default field values
checkColumn()  : bool
Check unique columns
getCreateMessage()  : string
Get create message name
getDefaultValues()  : array<string|int, mixed>
Get default values
getDeleteMessage()  : string
Get delete message name
getReadMessage()  : string
Get read message name
getUniqueColumns()  : array<string|int, mixed>
Get unique columns
getUpdateMessage()  : string
Get update message name
onAfterCreate()  : void
Set after create
onAfterDelete()  : void
Set after delete
onAfterUpdate()  : void
Set after update
onBeforeCreate()  : void
Set before create
onBeforeDelete()  : void
Set before delete
onBeforeRead()  : void
Set before read
onBeforeUpdate()  : void
Set before update
resolveCallback()  : mixed
Resolve callback

Properties

$afterCreateCallback

After create

protected Closure|null $afterCreateCallback = null

$afterDeleteCallback

After delete

protected Closure|null $afterDeleteCallback = null

$afterUpdateCallback

After update

protected Closure|null $afterUpdateCallback = null

$beforeCreateCallback

Before create

protected Closure|null $beforeCreateCallback = null

$beforeDeleteCallback

Before delete

protected Closure|null $beforeDeleteCallback = null

$beforeReadCallback

Before read

protected Closure|null $beforeReadCallback = null

$beforeUpdateCallback

Before update

protected Closure|null $beforeUpdateCallback = null

Methods

create()

Create model

public create(ServerRequestInterface $request, ResponseInterface $response, Validator $data) : ResponseInterface
Parameters
$request : ServerRequestInterface
$response : ResponseInterface
$data : Validator
Return values
ResponseInterface

deleteController()

Delete model

public deleteController(ServerRequestInterface $request, ResponseInterface $response, Validator $data) : ResponseInterface
Parameters
$request : ServerRequestInterface
$response : ResponseInterface
$data : Validator
Return values
ResponseInterface

read()

Read model

public read(ServerRequestInterface $request, ResponseInterface $response, Validator $data) : ResponseInterface
Parameters
$request : ServerRequestInterface
$response : ResponseInterface
$data : Validator
Return values
ResponseInterface

update()

Update model

public update(ServerRequestInterface $request, ResponseInterface $response, Validator $data) : ResponseInterface
Parameters
$request : ServerRequestInterface
$response : ResponseInterface
$data : Validator
Return values
ResponseInterface

applyDefaultValues()

Apply default field values

protected applyDefaultValues(mixed $data) : mixed
Parameters
$data : mixed

checkColumn()

Check unique columns

protected checkColumn(Model|object $model, Collection $data[, int $excludeId = null ]) : bool
Parameters
$model : Model|object
$data : Collection
$excludeId : int = null
Return values
bool

getCreateMessage()

Get create message name

protected getCreateMessage() : string
Return values
string

getDefaultValues()

Get default values

protected getDefaultValues() : array<string|int, mixed>
Return values
array<string|int, mixed>

getDeleteMessage()

Get delete message name

protected getDeleteMessage() : string
Return values
string

getReadMessage()

Get read message name

protected getReadMessage() : string
Return values
string

getUniqueColumns()

Get unique columns

protected getUniqueColumns() : array<string|int, mixed>
Return values
array<string|int, mixed>

getUpdateMessage()

Get update message name

protected getUpdateMessage() : string
Return values
string

onAfterCreate()

Set after create

protected onAfterCreate(Closure $callback) : void
Parameters
$callback : Closure

onAfterDelete()

Set after delete

protected onAfterDelete(Closure $callback) : void
Parameters
$callback : Closure

onAfterUpdate()

Set after update

protected onAfterUpdate(Closure $callback) : void
Parameters
$callback : Closure

onBeforeCreate()

Set before create

protected onBeforeCreate(Closure $callback) : void
Parameters
$callback : Closure

onBeforeDelete()

Set before delete

protected onBeforeDelete(Closure $callback) : void
Parameters
$callback : Closure

onBeforeRead()

Set before read

protected onBeforeRead(Closure $callback) : void
Parameters
$callback : Closure

onBeforeUpdate()

Set before update

protected onBeforeUpdate(Closure $callback) : void
Parameters
$callback : Closure

resolveCallback()

Resolve callback

private resolveCallback(mixed $data, Closure|null $callback[, object|null $model = null ]) : mixed
Parameters
$data : mixed
$callback : Closure|null
$model : object|null = null

        
On this page

Search results