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

[9.x] Add method to remove a middleware from a group #44780

Merged
merged 5 commits into from
Oct 31, 2022

Conversation

mateusjatenee
Copy link
Contributor

On Magic Test, I need to dynamically register a middleware and in some situations that middleware needs to also be removed.

The current way is rebinding the middleware in the container to an implementation that doesn't really do anything. I think having the ability to remove it from a group is a cleaner way to do it, and since you can already rebind dependencies on the container I don't think it'd be a problem.

P.S: this PR also includes some tests for pushMiddlewareToGroup, in case it isn't accepted I can send it on a separate PR.
Also: I wasn't sure if I should use types or not on this PR since it is aimed at v9, but I can add them if necessary. 👍

@taylorotwell taylorotwell merged commit 779fe61 into laravel:9.x Oct 31, 2022
@mateusjatenee mateusjatenee deleted the remove-middleware branch October 31, 2022 14:13
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.

None yet

2 participants