I have a resource route defined as such:

Route::resource('event.invite', 'EventInvitesController');

I would like to be able to localize my url's but maintain the route and parameter names. I've tried doing something like this

$eventInviteNames = [
    'create' => 'event.invites.create',
    'store' => 'event.invites.store',
    'index' => 'event.invites.index',
    'update' => 'event.invites.update',
    'destroy' => 'event.invites.destroy',
    'edit' => 'event.invites.edit',
    'show' => 'event.invites.show',
];

if($lang = 'de') {
    Route::resource(
        'veranstaltung.einladung',
        'EventInvitesController',
        ['names'=>eventInviteNames]
    );
} else if($lang = ...

But not only is this rather verbose but it doesn't fix parameter names. I've also tried a few things like

Route::resource('veranstalltung{event}.einladung{invite}', 'EventInvitesController');

So how would I go about localizing resource route url's?

0 Answers