Documentation

ResourceRegistrar
in package

Table of Contents

$parameterMap  : array<string|int, mixed>
The global parameter mapping.
$parameters  : array<string|int, mixed>|string
The parameters set for this resource instance.
$resourceDefaults  : array<string|int, mixed>
The default actions for a resourceful controller.
$router  : Router
The router instance.
$singularParameters  : bool
Singular global parameters.
$verbs  : array<string|int, mixed>
The verbs used in the resource URIs.
__construct()  : void
Create a new resource registrar instance.
getParameters()  : array<string|int, mixed>
Get the global parameter map.
getResourceUri()  : string
Get the base resource URI for a given resource.
getResourceWildcard()  : string
Format a resource parameter for usage.
register()  : void
Route a resource to a controller.
setParameters()  : void
Set the global parameter mapping.
singularParameters()  : void
Set or unset the unmapped global parameters to singular.
verbs()  : array<string|int, mixed>
Get or set the action verbs used in the resource URIs.
addResourceCreate()  : Route
Add the create method for a resourceful route.
addResourceDestroy()  : Route
Add the destroy method for a resourceful route.
addResourceEdit()  : Route
Add the edit method for a resourceful route.
addResourceIndex()  : Route
Add the index method for a resourceful route.
addResourceShow()  : Route
Add the show method for a resourceful route.
addResourceStore()  : Route
Add the store method for a resourceful route.
addResourceUpdate()  : Route
Add the update method for a resourceful route.
getNestedResourceUri()  : string
Get the URI for a nested resource segment array.
getResourceAction()  : array<string|int, mixed>
Get the action array for a resource route.
getResourceMethods()  : array<string|int, mixed>
Get the applicable resource methods.
getResourcePrefix()  : array<string|int, mixed>
Extract the resource and prefix from a resource name.
getResourceRouteName()  : string
Get the name for a given resource.
prefixedResource()  : void
Build a set of prefixed resource routes.

Properties

$parameterMap

The global parameter mapping.

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

$parameters

The parameters set for this resource instance.

protected array<string|int, mixed>|string $parameters

$resourceDefaults

The default actions for a resourceful controller.

protected array<string|int, mixed> $resourceDefaults = ['index', 'create', 'store', 'show', 'edit', 'update', 'destroy']

$singularParameters

Singular global parameters.

protected static bool $singularParameters = true

$verbs

The verbs used in the resource URIs.

protected static array<string|int, mixed> $verbs = ['create' => 'create', 'edit' => 'edit']

Methods

__construct()

Create a new resource registrar instance.

public __construct(Router $router) : void
Parameters
$router : Router
Return values
void

getParameters()

Get the global parameter map.

public static getParameters() : array<string|int, mixed>
Return values
array<string|int, mixed>

getResourceUri()

Get the base resource URI for a given resource.

public getResourceUri(string $resource) : string
Parameters
$resource : string
Return values
string

getResourceWildcard()

Format a resource parameter for usage.

public getResourceWildcard(string $value) : string
Parameters
$value : string
Return values
string

register()

Route a resource to a controller.

public register(string $name, string $controller[, array<string|int, mixed> $options = [] ]) : void
Parameters
$name : string
$controller : string
$options : array<string|int, mixed> = []
Return values
void

setParameters()

Set the global parameter mapping.

public static setParameters([array<string|int, mixed> $parameters = [] ]) : void
Parameters
$parameters : array<string|int, mixed> = []
Return values
void

singularParameters()

Set or unset the unmapped global parameters to singular.

public static singularParameters([bool $singular = true ]) : void
Parameters
$singular : bool = true
Return values
void

verbs()

Get or set the action verbs used in the resource URIs.

public static verbs([array<string|int, mixed> $verbs = [] ]) : array<string|int, mixed>
Parameters
$verbs : array<string|int, mixed> = []
Return values
array<string|int, mixed>

addResourceCreate()

Add the create method for a resourceful route.

protected addResourceCreate(string $name, string $base, string $controller, array<string|int, mixed> $options) : Route
Parameters
$name : string
$base : string
$controller : string
$options : array<string|int, mixed>
Return values
Route

addResourceDestroy()

Add the destroy method for a resourceful route.

protected addResourceDestroy(string $name, string $base, string $controller, array<string|int, mixed> $options) : Route
Parameters
$name : string
$base : string
$controller : string
$options : array<string|int, mixed>
Return values
Route

addResourceEdit()

Add the edit method for a resourceful route.

protected addResourceEdit(string $name, string $base, string $controller, array<string|int, mixed> $options) : Route
Parameters
$name : string
$base : string
$controller : string
$options : array<string|int, mixed>
Return values
Route

addResourceIndex()

Add the index method for a resourceful route.

protected addResourceIndex(string $name, string $base, string $controller, array<string|int, mixed> $options) : Route
Parameters
$name : string
$base : string
$controller : string
$options : array<string|int, mixed>
Return values
Route

addResourceShow()

Add the show method for a resourceful route.

protected addResourceShow(string $name, string $base, string $controller, array<string|int, mixed> $options) : Route
Parameters
$name : string
$base : string
$controller : string
$options : array<string|int, mixed>
Return values
Route

addResourceStore()

Add the store method for a resourceful route.

protected addResourceStore(string $name, string $base, string $controller, array<string|int, mixed> $options) : Route
Parameters
$name : string
$base : string
$controller : string
$options : array<string|int, mixed>
Return values
Route

addResourceUpdate()

Add the update method for a resourceful route.

protected addResourceUpdate(string $name, string $base, string $controller, array<string|int, mixed> $options) : Route
Parameters
$name : string
$base : string
$controller : string
$options : array<string|int, mixed>
Return values
Route

getNestedResourceUri()

Get the URI for a nested resource segment array.

protected getNestedResourceUri(array<string|int, mixed> $segments) : string
Parameters
$segments : array<string|int, mixed>
Return values
string

getResourceAction()

Get the action array for a resource route.

protected getResourceAction(string $resource, string $controller, string $method, array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
$resource : string
$controller : string
$method : string
$options : array<string|int, mixed>
Return values
array<string|int, mixed>

getResourceMethods()

Get the applicable resource methods.

protected getResourceMethods(array<string|int, mixed> $defaults, array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
$defaults : array<string|int, mixed>
$options : array<string|int, mixed>
Return values
array<string|int, mixed>

getResourcePrefix()

Extract the resource and prefix from a resource name.

protected getResourcePrefix(string $name) : array<string|int, mixed>
Parameters
$name : string
Return values
array<string|int, mixed>

getResourceRouteName()

Get the name for a given resource.

protected getResourceRouteName(string $resource, string $method, array<string|int, mixed> $options) : string
Parameters
$resource : string
$method : string
$options : array<string|int, mixed>
Return values
string

prefixedResource()

Build a set of prefixed resource routes.

protected prefixedResource(string $name, string $controller, array<string|int, mixed> $options) : void
Parameters
$name : string
$controller : string
$options : array<string|int, mixed>
Return values
void

Search results