Reputation: 30956
In my front end I have a collection
of models
. Each collection
can communicate with the back end and each model
can also communicate with the back end.
I am trying to devise the proper url routes for it here is what I am thinking
create [POST] /mycollection
update [PATCH] /mycollection/22
delete [DELETE] /mycollection/22
and for the models
create [POST] /mycollection/22
update [PATCH] /mycollection/22/3
delete [DELETE] /mycollection/22/3
How should I create my routes in Laravel?
I'm looking into route groups but it's still quite a bit of boiler plate it seems.
Route::group(array('prefix' => 'mycollection'), function()
{
Route::get('{id}', function($id){});
Route::post('/', function(){});
Route::patch('{id}', function($id){});
Route::destroy('{id}', function($id){});
Route::get('{id}/{child_id}', function($id, $child_id){});
Route::post('{id}', function($id){});
Route::patch('{id}/{child_id}', function($id, $child_id){});
Route::destroy('{id}/{child_id}', function($id, $child_id){});
});
Upvotes: 0
Views: 107