-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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.5] Promote RouteGroup to first-class citizen, enabling $router->getGroups(). #20820
[5.5] Promote RouteGroup to first-class citizen, enabling $router->getGroups(). #20820
Conversation
I'm not super familiar with the code here, so I can't speak to that, but the idea sounds really interesting. |
That will have to go to v5.6 now. |
Just noting that I don't think this actually needs to go in 5.6 |
I changed the branch to v5.5. |
Oh yeah thanks! Shoulda remembered that. |
What will this enable application developers to do? |
I believe this was tied to this package: I'm not sure what exactly it was for, it can be found on the twenty percent time podcast. Would be nice if @DanielCoulbourne could explain though ^^ |
@taylorotwell This pull itself will only enable devs to get the route groups. Probably not the most useful feature on its own. But like I said above this is kind of a "test the waters" PR to see if you're even open to this sort of thing. If you are, there are a few ancillary things I'd like to PR in that I do have a need for: The biggest one is building |
For reference, this PR, its implications, etc. were discussed in Twenty Percent Time. |
Could you take a look at the conflicts on this? I plan to pull it down today to play with it. |
Yep just a sec (I broke something) |
@taylorotwell fixed. Sorry about that. I was trying to resolve merge conflicts in the branch I used for the 5.4 version and lost my mind for a bit. Derp. |
@taylorotwell Any updates? |
@m1guelpf We've been talking back and forth on it a bit. I know Taylor has taken a look at it. |
There definitely are breaking changes. Protected methods have been deleted from non-final classes. Should go to 5.6. |
Going to hold off for now until I see the end-goal macro implemented using this PR's functionality. Without that I'm scared we don't have hard proof this acutally solves what we're trying to achieve. |
Challenge accepted 😛 |
I've always wanted to do more with Route groups, but because they have been primarily used as stacks of attributes which were immediately flattened and didn't persist outside of their registration, there wasn't much to do.
This PR introduces a
RouteGroup
object and a$groups
array onRouter
which is a persistent registry of RouteGroups.RouteGroup
objects are aware of their routes via a RouteCollection.I also added a
getGroups()
method toRouter
.While pretty in depth in its changes, this is just an introductory "testing the waters" PR. If this PR is merged there are lots of things that could be built on top of persistent route groups:
$router->getRoutes()->getRoutesByGroup()
Note that the classname
RouteGroup
was already in use for a class of static methods relating to merging Route Group Attributes. I renamed this class toRouteGroupAttributes
Please let me know what you think of this PR. I think its a step in the right direction. I love Route Groups and would love to do more work with them, but I think they deserve a promotion.