Framework: route prefix on 5.3

Created on 2 Aug 2016  Â·  5Comments  Â·  Source: laravel/framework

route prefix wont prepend on resource name anymore. is it intended? or what is the other workaround for it? Thanks

Most helpful comment

I don't understand how a prefix defeats the purpose of route resources. I have a number of resources with a superadmin prefix. Now I have to spell out each resource name individually like this?

Route::resource(user', 'SuperAdmin\UserController', ['names' => [
  'create' => 'superadmin.user.create',
  'edit' => 'superadmin.user.edit',
  'show' => 'superadmin.user.show',
  'update' => 'superadmin.user.update',
  'destroy' => 'superadmin.user.destroy',
]]);

All 5 comments

Yes, this seems to be intended. See the Upgrade Guide for information about that:

Resource Route Names No Longer Affected By Prefixes

URL prefixes no longer affect the route names assigned to routes when using Route::resource, since this behavior defeated the entire purpose of using route names in the first place.

If your application is using Route::resource within a Route::group call that specified a prefix option, you should examine all of your calls to the route helper and verify that you are no longer appending the URI prefix to the route name.

If this change causes you to have two routes with the same name, you may use the names option when calling Route::resource to specify a custom name for a given route. Refer to the resource routing documentation for more information.

Thank you

I don't understand how a prefix defeats the purpose of route resources. I have a number of resources with a superadmin prefix. Now I have to spell out each resource name individually like this?

Route::resource(user', 'SuperAdmin\UserController', ['names' => [
  'create' => 'superadmin.user.create',
  'edit' => 'superadmin.user.edit',
  'show' => 'superadmin.user.show',
  'update' => 'superadmin.user.update',
  'destroy' => 'superadmin.user.destroy',
]]);

yeah. . prepending route prefix is very well handy

On Mon, Aug 29, 2016 at 5:01 AM, lchogan [email protected] wrote:

I don't understand how a prefix defeats the purpose of route resources. I
have a number of resources with a superadmin prefix. Now I have to spell
out each resource name individually like this?

Route::resource(user', 'SuperAdmin\UserController', ['names' => [
'create' => 'superadmin.user.create',
'edit' => 'superadmin.user.edit',
'show' => 'superadmin.user.show',
'update' => 'superadmin.user.update',
'destroy' => 'superadmin.user.destroy',
]]);

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/laravel/framework/issues/14593#issuecomment-242999038,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AICvCAoWiUMFupInN5mtbK3wT8rgnWxoks5qkfcsgaJpZM4JaVuY
.

Using Laravel 5.3.9
See comment from "john5db commented on 6 Jul • edited" from https://github.com/laravel/framework/issues/13903..
It describes perfectly the problem.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RomainSauvaire picture RomainSauvaire  Â·  3Comments

YannPl picture YannPl  Â·  3Comments

digirew picture digirew  Â·  3Comments

CupOfTea696 picture CupOfTea696  Â·  3Comments

lzp819739483 picture lzp819739483  Â·  3Comments