Resource
abstract class Resource (View source)
Properties
| protected string | $contentType | ||
| static protected array<string, array{0: string|string[], 1: string, 2: string|null}> | $routeMapping | Define methods and routes |
Methods
bool
mount()
Registers routes for each resource method implemented by this class.
static
dispatch()
Instantiates the controller and dispatches its routes against the global $app.
Details
__construct(App $context)
Create routes basead in a Controller or other Class
bool
mount()
Registers routes for each resource method implemented by this class.
Only methods present in both $valids and the concrete class are registered. Returns true if at least one route was registered.
static
dispatch()
Instantiates the controller and dispatches its routes against the global $app.
Intended as a one-line convenience call from route definition files. Throws if the global $app is unavailable or no routes are found.