ResourceRegistrar
class ResourceRegistrar
Properties
protected Router | $router | The router instance. |
|
protected array | $resourceDefaults | The default actions for a resourceful controller. |
|
protected array|string | $parameters | The parameters set for this resource instance. |
|
static protected array | $parameterMap | The global parameter mapping. |
|
static protected bool | $singularParameters | Singular global parameters. |
|
static protected array | $verbs | The verbs used in the resource URIs. |
Methods
Route a resource to a controller.
Build a set of prefixed resource routes.
Extract the resource and prefix from a resource name.
Get the applicable resource methods.
Add the index method for a resourceful route.
Add the create method for a resourceful route.
Add the store method for a resourceful route.
Add the show method for a resourceful route.
Add the edit method for a resourceful route.
Add the update method for a resourceful route.
Add the destroy method for a resourceful route.
Get the base resource URI for a given resource.
Get the URI for a nested resource segment array.
Format a resource parameter for usage.
Get the action array for a resource route.
Get the name for a given resource.
Set or unset the unmapped global parameters to singular.
Get the global parameter map.
Set the global parameter mapping.
Get or set the action verbs used in the resource URIs.
Details
at line 60
void
__construct(Router $router)
Create a new resource registrar instance.
at line 73
void
register(string $name, string $controller, array $options = [])
Route a resource to a controller.
at line 108
protected void
prefixedResource(string $name, string $controller, array $options)
Build a set of prefixed resource routes.
at line 128
protected array
getResourcePrefix(string $name)
Extract the resource and prefix from a resource name.
at line 147
protected array
getResourceMethods(array $defaults, array $options)
Get the applicable resource methods.
at line 167
protected Route
addResourceIndex(string $name, string $base, string $controller, array $options)
Add the index method for a resourceful route.
at line 185
protected Route
addResourceCreate(string $name, string $base, string $controller, array $options)
Add the create method for a resourceful route.
at line 203
protected Route
addResourceStore(string $name, string $base, string $controller, array $options)
Add the store method for a resourceful route.
at line 221
protected Route
addResourceShow(string $name, string $base, string $controller, array $options)
Add the show method for a resourceful route.
at line 239
protected Route
addResourceEdit(string $name, string $base, string $controller, array $options)
Add the edit method for a resourceful route.
at line 257
protected Route
addResourceUpdate(string $name, string $base, string $controller, array $options)
Add the update method for a resourceful route.
at line 275
protected Route
addResourceDestroy(string $name, string $base, string $controller, array $options)
Add the destroy method for a resourceful route.
at line 290
string
getResourceUri(string $resource)
Get the base resource URI for a given resource.
at line 312
protected string
getNestedResourceUri(array $segments)
Get the URI for a nested resource segment array.
at line 328
string
getResourceWildcard(string $value)
Format a resource parameter for usage.
at line 350
protected array
getResourceAction(string $resource, string $controller, string $method, array $options)
Get the action array for a resource route.
at line 371
protected string
getResourceRouteName(string $resource, string $method, array $options)
Get the name for a given resource.
at line 400
static void
singularParameters(bool $singular = true)
Set or unset the unmapped global parameters to singular.
at line 410
static array
getParameters()
Get the global parameter map.
at line 421
static void
setParameters(array $parameters = [])
Set the global parameter mapping.
at line 432
static array
verbs(array $verbs = [])
Get or set the action verbs used in the resource URIs.