I am creating Elequent models with the following structure:
Event->hasMany(Invite)
Invite->belongsTo(Event)
I am creating a controller with the following artisan command:
php artisan make:controller -mInvite -pEvent EventInvitesController --resource
Now if I create custom routes like:
Route::get('event/{event}/invite', 'EventInvitesController@index')->name('event.invites.index');
Route::post('event/{event}/invite', 'EventInvitesController@store')->name('event.invites.store');
Route::get('event/{event}/invite/{invite}', 'EventInvitesController@show')->name('event.invites.show');
Route::put('event/{event}/invite/{invite}', 'EventInvitesController@update')->name('event.invites.update');
Route::delete('event/{event}/invite/{invite}', 'EventInvitesController@destroy')->name('event.invites.destroy');
Route::get('event/{event}/invite/{invite}/edit', 'EventInvitesController@edit')->name('event.invites.edit');
Then everything works fine. But I was wondering if there is a way to do this like
Route::resource('event-invites', 'EventInvitesController');
When I've tried to do this the routes only have a single {event_invites} paramater when I need two.
Is there a way to enable routing for the parent model in Route::resource()? If not how would I go about extending Route to provide such a method?