Skip to content

Instantly share code, notes, and snippets.

@geoidesic
Created August 3, 2020 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geoidesic/fbd4d4a14ffe7b689134a2f299567427 to your computer and use it in GitHub Desktop.
Save geoidesic/fbd4d4a14ffe7b689134a2f299567427 to your computer and use it in GitHub Desktop.
Routing for CrudJsonControllerTrait
Router::prefix('api', function (RouteBuilder $routes) {
$routes->connect('/{controller}/{id}/relationships/{foreignTableName}', ['_method' => 'DELETE', 'action' => 'deleterelationships']);
$routes->connect('/{controller}/{id}/relationships/{foreignTableName}', ['_method' => 'PATCH', 'action' => 'updaterelationships']);
$routes->connect('/{controller}/{id}/relationships/{foreignTableName}', ['_method' => 'POST', 'action' => 'postrelationships']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment