-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.3] (Revert) Resource Route Names No Longer Affected By Prefixes #15058
Comments
I think this was intended. Feel free to ask around on internals, or search for other issues. |
@GrahamCampbell yes it was intended as documented. Submitting on internals to get what other thinks about it. Thanks! |
Same issue here. I have a superadmin prefix for many of my resources and the same resources without the superadmin. Now that I upgraded to 5.3 I have to write out each superadmin route. This completely negates the advantages of the route resources IMO. Thanks. |
@GrahamCampbell maybe we can re-open this issue so that others may see and get a feedback from them like the issue thread on #15072? Got 3 thumbs up on Internal issue + @lchogan so maybe this is worth for reconsideration? Thanks! |
@yajra why should resource route name be affected by prefix?
What happen when you need to change the prefix |
@crynobone changing from @RDelorier suggested a workaround to use Route::group([
'as' => 'admin.', // the trailing dot makes me think this is unintended
'prefix' => 'admin'
], function () {
Route::resource('users', 'UserController');
});
Route::resource('users', 'UserController'); Thanks for the feedbacks! |
Definitely a breaking change (many breaking ones like this makes 5.3 eligible for 6.0) |
This changed because before when using |
but adding .(dot) i.e. and i guess people were using only |
I agree, however it gives some the opportunity to use _ instead I guess. Personally I would prefer the decimal included automatically. |
will give us: etc.... How do we fix this? |
Fix what? |
Various auth routes having the same route name |
Don't do that with auth routes. |
So how do I do it if I want the following routes: admin.login, admin.logout, admin.resetpassword...etc? |
I'm confused as to why you would need that anyways? Erm... I guess maybe you are overriding an API and Web route, thereby creating the dupe route. (api and web both changed to admin) |
Because the project I'm working on has the authentication on the admin only and I want my routes organized that way so that I know which part of the application the routes are for. I'm just concerned if having those auth related routes having the same 'admin.' name will not have unpredictable effects on the whole auth process... |
Auth Routes command is here: https://github.com/laravel/framework/blob/5.3/src/Illuminate/Support/Facades/Auth.php#L30 Which runs: https://github.com/laravel/framework/blob/5.3/src/Illuminate/Routing/Router.php#L287 You could remake them yourself if you like and not use Auth::routes() |
thanks |
You're welcome! |
This worked for me : // Backend post resource // Frontend post resource |
Given the changes above, how would you group your resource routes on Laravel 5.3?
For instance, I have an application that have frontend & backend panel with same route resource?
In 5.2:
This will yield a better grouping on resource route name.
But on 5.3, same route will produce duplicate names.
Hence if you use
route()
helper then your upgrade path to 5.3 is doomed!I know that we can fix it by manually naming the routes on administrator side (which is what I did on my project) but considering a big project, IMHO, too much code duplications! Imagine that we have to manually write all our administrator resource routes?
I hope this can be reconsidered. Or if there is better way that I am missing, please enlighten me. Thanks!
The text was updated successfully, but these errors were encountered: