Controller
Will add a new Controller file with a skeleton for methods and optionally add routes to the config.
Example
tramway create:controller ProductController --add-routes --actions get getOne create
Options
Argument | Command Type | Type | Default | Required | Comments |
---|---|---|---|---|---|
name | argument | string | none | yes | The name of the Controller class |
dir | option | string | controllers | no | An option to override the default folder the Controller class will be created in |
actions | option | array | none | no | An array of methods the Controller will have |
add-routes | option | boolean | false | no | A flag to indicate that a route should be created when making the Controller |
routes-dir | option | string | config | no | An option to override the default folder where the routing config will be placed |
routes-filename | option | string | routes | no | An option to override the default filename of the routes config |
version | option | number | latest | no | An option to specify which version of the class to use |