CAKEPHP3 REST API point to a different controller? -
i believe missing here. trying point route custom controller:
router::scope('/myapi/', function ($routes) { $routes->extensions(['json', 'xml']); $routes->resources('some_value', [ 'controller'=>'somevalue', 'only' => ['index', 'create', 'update', 'delete'], 'id'=>'[0-9]+' ]); });
therefore url wanting ~mydomain~/myapi/some_value.
i want point somevaluecontroller instead of looking some_valuecontroller. controller definition ignored in case , instead cakephp3 looks some_valuecontroller instead rather avoid try , keep cakephp's naming conventions (and make use of cake bake console create lot of controllers models me) specify custom url.
what have missed here?
thanks,
nevermind, if titlecase name works:
$routes->resources( 'somevalue', [ 'only' => ['index', 'create', 'update', 'delete'], 'id'=>'[0-9]+' ]);
this allows url of some_value , points correct controller.
posted in case helps else.
Comments
Post a Comment