ResourceRegistrar

class ResourceRegistrar (View source)

Properties

protected Router $router The router instance.
protected array $resourceDefaults The default actions for a resourceful controller.

Methods

void __construct(Router $router)

Create a new resource registrar instance.

void register(string $name, string $controller, array $options = [])

Route a resource to a controller.

void prefixedResource(string $name, string $controller, array $options)

Build a set of prefixed resource routes.

array getResourcePrefix(string $name)

Extract the resource and prefix from a resource name.

array getResourceMethods(array $defaults, array $options)

Get the applicable resource methods.

string getResourceUri(string $resource)

Get the base resource URI for a given resource.

string getNestedResourceUri(array $segments)

Get the URI for a nested resource segment array.

array getResourceAction(string $resource, string $controller, string $method, array $options)

Get the action array for a resource route.

string getResourceName(string $resource, string $method, array $options)

Get the name for a given resource.

string getGroupResourceName(string $prefix, string $resource, string $method)

Get the resource name for a grouped resource.

string getResourceWildcard(string $value)

Format a resource wildcard for usage.

Route addResourceIndex(string $name, string $base, string $controller, array $options)

Add the index method for a resourceful route.

Route addResourceCreate(string $name, string $base, string $controller, array $options)

Add the create method for a resourceful route.

Route addResourceStore(string $name, string $base, string $controller, array $options)

Add the store method for a resourceful route.

Route addResourceShow(string $name, string $base, string $controller, array $options)

Add the show method for a resourceful route.

Route addResourceEdit(string $name, string $base, string $controller, array $options)

Add the edit method for a resourceful route.

void addResourceUpdate(string $name, string $base, string $controller, array $options)

Add the update method for a resourceful route.

Route addPutResourceUpdate(string $name, string $base, string $controller, array $options)

Add the update method for a resourceful route.

void addPatchResourceUpdate(string $name, string $base, string $controller)

Add the update method for a resourceful route.

Route addResourceDestroy(string $name, string $base, string $controller, array $options)

Add the destroy method for a resourceful route.

Details

void __construct(Router $router)

Create a new resource registrar instance.

Parameters

Router $router

Return Value

void

void register(string $name, string $controller, array $options = [])

Route a resource to a controller.

Parameters

string $name
string $controller
array $options

Return Value

void

protected void prefixedResource(string $name, string $controller, array $options)

Build a set of prefixed resource routes.

Parameters

string $name
string $controller
array $options

Return Value

void

protected array getResourcePrefix(string $name)

Extract the resource and prefix from a resource name.

Parameters

string $name

Return Value

array

protected array getResourceMethods(array $defaults, array $options)

Get the applicable resource methods.

Parameters

array $defaults
array $options

Return Value

array

string getResourceUri(string $resource)

Get the base resource URI for a given resource.

Parameters

string $resource

Return Value

string

protected string getNestedResourceUri(array $segments)

Get the URI for a nested resource segment array.

Parameters

array $segments

Return Value

string

protected array getResourceAction(string $resource, string $controller, string $method, array $options)

Get the action array for a resource route.

Parameters

string $resource
string $controller
string $method
array $options

Return Value

array

protected string getResourceName(string $resource, string $method, array $options)

Get the name for a given resource.

Parameters

string $resource
string $method
array $options

Return Value

string

protected string getGroupResourceName(string $prefix, string $resource, string $method)

Get the resource name for a grouped resource.

Parameters

string $prefix
string $resource
string $method

Return Value

string

string getResourceWildcard(string $value)

Format a resource wildcard for usage.

Parameters

string $value

Return Value

string

protected Route addResourceIndex(string $name, string $base, string $controller, array $options)

Add the index method for a resourceful route.

Parameters

string $name
string $base
string $controller
array $options

Return Value

Route

protected Route addResourceCreate(string $name, string $base, string $controller, array $options)

Add the create method for a resourceful route.

Parameters

string $name
string $base
string $controller
array $options

Return Value

Route

protected Route addResourceStore(string $name, string $base, string $controller, array $options)

Add the store method for a resourceful route.

Parameters

string $name
string $base
string $controller
array $options

Return Value

Route

protected Route addResourceShow(string $name, string $base, string $controller, array $options)

Add the show method for a resourceful route.

Parameters

string $name
string $base
string $controller
array $options

Return Value

Route

protected Route addResourceEdit(string $name, string $base, string $controller, array $options)

Add the edit method for a resourceful route.

Parameters

string $name
string $base
string $controller
array $options

Return Value

Route

protected void addResourceUpdate(string $name, string $base, string $controller, array $options)

Add the update method for a resourceful route.

Parameters

string $name
string $base
string $controller
array $options

Return Value

void

protected Route addPutResourceUpdate(string $name, string $base, string $controller, array $options)

Add the update method for a resourceful route.

Parameters

string $name
string $base
string $controller
array $options

Return Value

Route

protected void addPatchResourceUpdate(string $name, string $base, string $controller)

Add the update method for a resourceful route.

Parameters

string $name
string $base
string $controller

Return Value

void

protected Route addResourceDestroy(string $name, string $base, string $controller, array $options)

Add the destroy method for a resourceful route.

Parameters

string $name
string $base
string $controller
array $options

Return Value

Route

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.1/Illuminate/Routing/ResourceRegistrar.html