Documentation

ResourcePresenter extends BaseResource
in package

An extendable controller to help provide a UI for a resource.

Table of Contents

$forceHTTPS  : int
Should enforce HTTPS access for all methods in this controller.
$helpers  : array<string|int, mixed>
Helpers that will be automatically loaded on class instantiation.
$logger  : LoggerInterface
Instance of logger to use.
$model  : object|null
$modelName  : string|null
$request  : RequestInterface
Instance of the main Request object.
$response  : ResponseInterface
Instance of the main response object.
$validator  : Validation
Once validation has been run, will hold the Validation instance.
create()  : mixed
Process the creation/insertion of a new resource object.
delete()  : mixed
Process the deletion of a specific resource object
edit()  : mixed
Present a view to edit the properties of a specific resource object
index()  : mixed
Present a view of resource objects
initController()  : mixed
Constructor.
new()  : mixed
Present a view to present a new single resource object
remove()  : mixed
Present a view to confirm the deletion of a specific resource object
setModel()  : void
Set or change the model this controller is bound to.
show()  : mixed
Present a view to present a specific resource object
update()  : mixed
Process the updating, full or partial, of a specific resource object.
cachePage()  : mixed
Provides a simple way to tie into the main CodeIgniter class and tell it how long to cache the current page for.
forceHTTPS()  : mixed
A convenience method to use when you need to ensure that a single method is reached only via HTTPS. If it isn't, then a redirect will happen back to this method and HSTS header will be sent to have modern browsers transform requests automatically.
loadHelpers()  : mixed
Handles "auto-loading" helper files.
validate()  : bool
A shortcut to performing validation on input data. If validation is not successful, a $errors property will be set on this class.

Properties

$forceHTTPS

Should enforce HTTPS access for all methods in this controller.

protected int $forceHTTPS = 0

Number of seconds to set HSTS header

$helpers

Helpers that will be automatically loaded on class instantiation.

protected array<string|int, mixed> $helpers = []

$model

protected object|null $model

The model that holding this resource's data

$modelName

protected string|null $modelName

The model that holding this resource's data

$validator

Once validation has been run, will hold the Validation instance.

protected Validation $validator

Methods

create()

Process the creation/insertion of a new resource object.

public create() : mixed

This should be a POST.

Return values
mixed

delete()

Process the deletion of a specific resource object

public delete([mixed $id = null ]) : mixed
Parameters
$id : mixed = null
Return values
mixed

edit()

Present a view to edit the properties of a specific resource object

public edit([mixed $id = null ]) : mixed
Parameters
$id : mixed = null
Return values
mixed

index()

Present a view of resource objects

public index() : mixed
Return values
mixed

new()

Present a view to present a new single resource object

public new() : mixed
Return values
mixed

remove()

Present a view to confirm the deletion of a specific resource object

public remove([mixed $id = null ]) : mixed
Parameters
$id : mixed = null
Return values
mixed

setModel()

Set or change the model this controller is bound to.

public setModel([object|string|null $which = null ]) : void

Given either the name or the object, determine the other.

Parameters
$which : object|string|null = null
Return values
void

show()

Present a view to present a specific resource object

public show([mixed $id = null ]) : mixed
Parameters
$id : mixed = null
Return values
mixed

update()

Process the updating, full or partial, of a specific resource object.

public update([mixed $id = null ]) : mixed

This should be a POST.

Parameters
$id : mixed = null
Return values
mixed

cachePage()

Provides a simple way to tie into the main CodeIgniter class and tell it how long to cache the current page for.

protected cachePage(int $time) : mixed
Parameters
$time : int
Return values
mixed

forceHTTPS()

A convenience method to use when you need to ensure that a single method is reached only via HTTPS. If it isn't, then a redirect will happen back to this method and HSTS header will be sent to have modern browsers transform requests automatically.

protected forceHTTPS([int $duration = 31536000 ]) : mixed
Parameters
$duration : int = 31536000

The number of seconds this link should be considered secure for. Only with HSTS header. Default value is 1 year.

Tags
throws
HTTPException
Return values
mixed

loadHelpers()

Handles "auto-loading" helper files.

protected loadHelpers() : mixed
Tags
deprecated

Use helper function instead of using this method.

codeCoverageIgnore
Return values
mixed

validate()

A shortcut to performing validation on input data. If validation is not successful, a $errors property will be set on this class.

protected validate(array<string|int, mixed>|string $rules[, array<string|int, mixed> $messages = [] ]) : bool
Parameters
$rules : array<string|int, mixed>|string
$messages : array<string|int, mixed> = []

An array of custom error messages

Return values
bool

Search results