I have a resource controller placed inside a route group like so:
Route::group(['as' => 'admin.', 'prefix' => 'admin'], function () {
Route::get('/', ['as' => 'index']);
Route::patch('categories/{id}', ['uses' => 'controller@restore', 'as' => 'categories.restore']);
Route::resource('categories', 'controller');
});
The first route is admin/
with route name admin.index
as expected.
The 'extra' resource route is admin/categories/{id}
with route name admin.categories.restore
.
But the strange things happen when we check the route names for the resource controller.
The routes are as expected, ed. admin/categories/{categories}
but the route names are al prefixed with admin.admin.
I know I can fix the problem by removing the as
in the route group and prefixing the route names for the other resources inside the group except the resource controller, but I'd like to find a way how to fix this without editing my route group.