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.0] Implemented Kernel::addMiddleware method to add middleware at runtime. #7834
Conversation
The only other thing I was tempted to do is perhaps bind the kernel to the container as $this->app['Illuminate\Contracts\Http\Kernel']->addMiddleware('FooMiddleware'); It would instead be... $this->app['kernel']->addMiddleware('FooMiddleware'); |
* Add a new middleware if it does not already exist. | ||
* | ||
* @param string $middleware | ||
* @return \Illuminate\Foundation\Http\Kernel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should just @return $this
i think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aye, fixed. Cheers mate.
Signed-off-by: Jason Lewis <jason.lewis1991@gmail.com>
54a5193
to
3ea6991
Compare
Would it perhaps make sense to make it possible to determine the order of the middleware? Eg. |
Makes sense @barryvdh , |
Wouldn't |
Yes mistyped |
Yeah I was contemplating that as well. Go that route you reckon? |
To keep our terms consistent we may want to use "pushMiddleware" for adding to the end (like session |
|
As per title and previous issue #6211.
This first checks to see if the middleware is already in the stack before adding it. This allows a custom order if it's required, otherwise it just adds it to the end.