Global Helpers
controller()
Signature
Section titled “Signature”controller() — returns any
Available in: controller, model, test, migrator, migration, tabledefinition
Category: Miscellaneous Functions
Description
Section titled “Description”The controller() function creates and returns a controller object with a custom name and optional parameters. It is primarily used for testing, but can also be used in code to instantiate a controller programmatically. Unlike the deprecated routing controller() function, this helper does not define routes—it creates controller instances.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | yes | — | Name of the controller to create. |
params | struct | no | [runtime expression] | The params struct (combination of form and URL variables). |
Examples
Section titled “Examples”testController = controller("users", params);