Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here's an example routing situation:
And currently, here are the resulting routes from
artisan routes
:With this patch, if you set the
as
option on the Route::resource() call, it will assume that that string is what you want to prefix your route names with, and not any of the route group names that are currently being added. This would solve several other issues (e.g. #1616) and updates the way #3000 solved it.While there might be some BC issues, I don't see them as truly major. If you are passing 'as' to your Route::resource(), then I don't think you'd be expecting any prefixes anyway.
In my case, this is for a package that supplies routes where the group
prefix
is configurable. And yes, I could use action based routing (as has always been suggested), but I think this fixes a general issue where routes aren't being named in a predictable way when you think they should be. :)Another solution would be to allow something like a
no_group_prefix
option to be passed, in which case my code would change from: