Controller

class Controller (View source)

Properties

protected array $middleware The middleware registered on the controller.
protected array $beforeFilters The "before" filters registered on the controller.
protected array $afterFilters The "after" filters registered on the controller.
static protected Router $router The router instance.

Methods

void middleware(string $middleware, array $options = [])

Register middleware on the controller.

void beforeFilter(Closure|string $filter, array $options = []) deprecated

Register a "before" filter on the controller.

void afterFilter(Closure|string $filter, array $options = []) deprecated

Register an "after" filter on the controller.

array parseFilter(Closure|string $filter, array $options)

Parse the given filter and options.

string registerClosureFilter(Closure $filter)

Register an anonymous controller filter Closure.

string registerInstanceFilter(string $filter)

Register a controller instance method as a filter.

bool isInstanceFilter(mixed $filter)

Determine if a filter is a local method on the controller.

void forgetBeforeFilter(string $filter) deprecated

Remove the given before filter.

void forgetAfterFilter(string $filter) deprecated

Remove the given after filter.

array removeFilter(string $removing, array $current)

Remove the given controller filter from the provided filter array.

array getMiddleware()

Get the middleware assigned to the controller.

array getBeforeFilters() deprecated

Get the registered "before" filters.

array getAfterFilters() deprecated

Get the registered "after" filters.

static Router getRouter()

Get the router instance.

static void setRouter(Router $router)

Set the router instance.

Response callAction(string $method, array $parameters)

Execute an action on the controller.

mixed missingMethod(array $parameters = [])

Handle calls to missing methods on the controller.

mixed __call(string $method, array $parameters)

Handle calls to missing methods on the controller.

Details

void middleware(string $middleware, array $options = [])

Register middleware on the controller.

Parameters

string $middleware
array $options

Return Value

void

void beforeFilter(Closure|string $filter, array $options = []) deprecated

deprecated

since version 5.1.

Register a "before" filter on the controller.

Parameters

Closure|string $filter
array $options

Return Value

void

void afterFilter(Closure|string $filter, array $options = []) deprecated

deprecated

since version 5.1.

Register an "after" filter on the controller.

Parameters

Closure|string $filter
array $options

Return Value

void

protected array parseFilter(Closure|string $filter, array $options)

Parse the given filter and options.

Parameters

Closure|string $filter
array $options

Return Value

array

protected string registerClosureFilter(Closure $filter)

Register an anonymous controller filter Closure.

Parameters

Closure $filter

Return Value

string

protected string registerInstanceFilter(string $filter)

Register a controller instance method as a filter.

Parameters

string $filter

Return Value

string

protected bool isInstanceFilter(mixed $filter)

Determine if a filter is a local method on the controller.

Parameters

mixed $filter

Return Value

bool

Exceptions

InvalidArgumentException

void forgetBeforeFilter(string $filter) deprecated

deprecated

since version 5.1.

Remove the given before filter.

Parameters

string $filter

Return Value

void

void forgetAfterFilter(string $filter) deprecated

deprecated

since version 5.1.

Remove the given after filter.

Parameters

string $filter

Return Value

void

protected array removeFilter(string $removing, array $current)

Remove the given controller filter from the provided filter array.

Parameters

string $removing
array $current

Return Value

array

array getMiddleware()

Get the middleware assigned to the controller.

Return Value

array

array getBeforeFilters() deprecated

deprecated

since version 5.1.

Get the registered "before" filters.

Return Value

array

array getAfterFilters() deprecated

deprecated

since version 5.1.

Get the registered "after" filters.

Return Value

array

static Router getRouter()

Get the router instance.

Return Value

Router

static void setRouter(Router $router)

Set the router instance.

Parameters

Router $router

Return Value

void

Response callAction(string $method, array $parameters)

Execute an action on the controller.

Parameters

string $method
array $parameters

Return Value

Response

mixed missingMethod(array $parameters = [])

Handle calls to missing methods on the controller.

Parameters

array $parameters

Return Value

mixed

Exceptions

NotFoundHttpException

mixed __call(string $method, array $parameters)

Handle calls to missing methods on the controller.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

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