Laravel Resource Routes Naming Prefix

- 1 answer

I've tow resource routes defined.

Route::resource('p/contacts', 'BaseData\PrivateContactsController');
Route::resource('b/contacts', 'BaseData\ContactController');

My Problem is that both resource group becomes the prefix same prefix (, contacts.edit...)

In the Laravel docs I found this way to name the routes

Route::resource('photos', 'PhotoController')->names([
'create' => ''

In my eyes this way is very complicated becaus I have to set the prefix for each single route. Is there a better way to set the prefix for all routes of the group?



Route::resource('p/contacts', 'BaseData\PrivateContactsController',["as"=>"private"]);
Route::resource('b/contacts', 'BaseData\ContactController',["as"=>"normal"]);

this way the urls will stay the same, but the names will have a prefix, for the first resource controller

private.contacts.index or private.contacts.edit

and for the second controller

    normal.contacts.create or

for more info check the documentation or this github issue