Controller

class Controller (View source)

Properties

protected array $beforeFilters The "before" filters registered on the controller.
protected array $afterFilters The "after" filters registered on the controller.
static protected RouteFiltererInterface $filterer The route filterer implementation.
protected View $layout The layout used by the controller.

Methods

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

Register a "before" filter on the controller.

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

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.

boolean isInstanceFilter(mixed $filter)

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

void forgetBeforeFilter(string $filter)

Remove the given before filter.

void forgetAfterFilter(string $filter)

Remove the given after filter.

array removeFilter(string $removing, array $current)

Remove the given controller filter from the provided filter array.

array getBeforeFilters()

Get the registered "before" filters.

array getAfterFilters()

Get the registered "after" filters.

static RouteFiltererInterface getFilterer()

Get the route filterer implementation.

static void setFilterer(RouteFiltererInterface $filterer)

Set the route filterer implementation.

void setupLayout()

Create the layout used by the controller.

Response callAction(string $method, array $parameters)

Execute an action on the controller.

mixed missingMethod(array $parameters = array())

Handle calls to missing methods on the controller.

mixed __call(string $method, array $parameters)

Handle calls to missing methods on the controller.

Details

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

Register a "before" filter on the controller.

Parameters

Closure|string $filter
array $options

Return Value

void

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

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 boolean isInstanceFilter(mixed $filter)

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

Parameters

mixed $filter

Return Value

boolean

Exceptions

InvalidArgumentException

void forgetBeforeFilter(string $filter)

Remove the given before filter.

Parameters

string $filter

Return Value

void

void forgetAfterFilter(string $filter)

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 getBeforeFilters()

Get the registered "before" filters.

Return Value

array

array getAfterFilters()

Get the registered "after" filters.

Return Value

array

static RouteFiltererInterface getFilterer()

Get the route filterer implementation.

Return Value

RouteFiltererInterface

static void setFilterer(RouteFiltererInterface $filterer)

Set the route filterer implementation.

Parameters

RouteFiltererInterface $filterer

Return Value

void

protected void setupLayout()

Create the layout used by the controller.

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 = array())

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/4.2/Illuminate/Routing/Controller.html