Skip to content
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.4] Adding minor features to the Router.php #17576

Merged
merged 3 commits into from
Jan 26, 2017
Merged

Conversation

MikeMnD
Copy link
Contributor

@MikeMnD MikeMnD commented Jan 26, 2017

Adding two new methods in the Router.php and according to

Minor features that are fully backwards compatible with the current Laravel release may be sent to the latest stable branch.

I make the PR to the 5.4 :)

Handy method to be used when you want to register Middleware from a ServiceProvider and use: 
prependMiddlewareToGroup
pushMiddlewareToGroup
Because they gracefully fail to add a middleware if a group is not existing first.
Also you can use:
middlewareGroup($name, array $middleware)
but still you can't be sure if you are overwriting an existing group ... since there is no way to check if the group already exist.
Also adding getMiddlewareGroups method just for convenience if you want to check multiple groups or do something in a foreach loop.
Add hasMiddlewareGroup and getMiddlewareGroups methods
@taylorotwell taylorotwell merged commit 9e91b44 into laravel:5.4 Jan 26, 2017
@GrahamCampbell GrahamCampbell changed the title Adding minor features to the Router.php [5.4] Adding minor features to the Router.php Jan 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants