Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 4 Route::resource with multiple parameters

I am trying to have a REST design, but I am running in a bit of a problem. I have a resource schedule. Therefore, the normal notation of /schedules/{id} is not very applicable since I would like to have /schedules/{day}/{month}/{year} and then apply REST, and have /edit and such.

Is there a way to do this with Route::resource() ? or do I need to do them through Route::get() ?

like image 768
Kousha Avatar asked Feb 13 '23 19:02

Kousha


1 Answers

As far as I know route::resource only gives you the routes that are detailed in the documentation so for what you want you would need to declare your own route. It is still restful and if it is only one of the resourceful routes you want to change you should still be able to do the following because the routes are prioritized in the order they are declared.

Route::get('schedule/{day}/{month}/{year}/edit', array('as' => 'editSchedule', 'uses' => 'ScheduleController@edit'));
Route::resource('schedule', 'ScheduleController');
like image 85
Mark Avatar answered Feb 20 '23 17:02

Mark