routing - Resource controller rotue name inside a route group in Laravel -


i have resource controller placed inside route group 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 admin/ route name admin.index expected.
'extra' resource route admin/categories/{id} route name admin.categories.restore.
strange things happen when check route names resource controller.
routes expected, ed. admin/categories/{categories} route names al prefixed admin.admin.

i know can fix problem removing as in route group , prefixing route names other resources inside group except resource controller, i'd find way how fix without editing route group.

the added image (part of) route lists route list

this comment on laravel github describes issue perfectly.
happend:
pre , resource controllers in route group first as declaration, prefix , use both define name, e.g. as.prefix.resource.

this issue shows clarification , changes made in laravel 5.3 prevent behaviour. in current form:

url prefixes no longer affect route names assigned routes when using route::resource, since behavior defeated entire purpose of using route names in first place.


Comments