Action
Action
Abstract controller action class.
This controller handles actions and responses using views
Properties
view
public ViewRenderer $viewmethods
protected array $methodsMethods
initialize
Initializes the controller action with the given request.
public initialize(Request $request): voidThis method checks if the request is an instance of HTTP, is not an XMLHttpRequest, the application is not null, the response type is 'html', and the application configuration has a 'layout' setting. If all these conditions are met, it sets the view layout to the specified layout in the application configuration.
Parameters
| Parameter | Type | Description |
|---|---|---|
$request | Request | the request object to initialize the action with |
registerMethod
Registers a new method with the given name and callback.
public registerMethod(string $name, callable $callback): boolParameters
| Parameter | Type | Description |
|---|---|---|
$name | string | the name of the method to register |
$callback | callable | the callback function to associate with the method |
runAction
Executes the specified action and returns the response.
public runAction(string $actionName, array $actionArgs, bool $namedActionArgs): ResponseParameters
| Parameter | Type | Description |
|---|---|---|
$actionName | string | the name of the action to execute |
$actionArgs | array | the arguments to pass to the action |
$namedActionArgs | bool | whether the action arguments are named |
view
Loads a view.
protected view(string $view, array $data): voidParameters
| Parameter | Type | Description |
|---|---|---|
$view | string | the name of the view to load |
$data | array | the data to pass to the view |
layout
Sets the layout view for the current controller.
protected layout(string $view): voidThis method sets the layout view that will be used to render the response.
Parameters
| Parameter | Type | Description |
|---|---|---|
$view | string | the name of the layout view to be used |
Generated by Hazaar API Doc Generator on Mon, 27 Oct 2025 13:01:29 +0000