class ViewController extends Controller (View source)

Properties

protected array $middleware

The middleware registered on the controller.

from  Controller
protected ResponseFactory $response

The response factory implementation.

Methods

middleware(Closure|array|string $middleware, array $options = [])

Register middleware on the controller.

array
getMiddleware()

Get the middleware assigned to the controller.

Response
callAction(string $method, array $parameters)

Execute an action on the controller.

mixed
__call(string $method, array $parameters)

Handle calls to missing methods on the controller.

void
__construct(ResponseFactory $response)

Create a new controller instance.

__invoke(mixed ...$args)

Invoke the controller method.

Details

ControllerMiddlewareOptions middleware(Closure|array|string $middleware, array $options = [])

Register middleware on the controller.

Parameters

Closure|array|string $middleware
array $options

Return Value

ControllerMiddlewareOptions

array getMiddleware()

Get the middleware assigned to the controller.

Return Value

array

Response callAction(string $method, array $parameters)

Execute an action on the controller.

Parameters

string $method
array $parameters

Return Value

Response

mixed __call(string $method, array $parameters)

Handle calls to missing methods on the controller.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

void __construct(ResponseFactory $response)

Create a new controller instance.

Parameters

ResponseFactory $response

Return Value

void

Response __invoke(mixed ...$args)

Invoke the controller method.

Parameters

mixed ...$args

Return Value

Response

Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.