-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
pushMiddleware changed order #15352
Comments
@mreschke What if you use |
@themsaid wow thank you so much. That is exactly what was need to get the middleware back in the same order. So from any "apps" provider
|
@mreschke Glad I could help :) |
How can I add middleware to the end of the full stack from a service provider in Laravel 5.3?
In Laravel 5.1 all of my "packages" pushed their own middleware in their service providers
boot()
method like so$kernel->pushMiddleware('Mrcore\Wiki\Http\Middleware\AnalyzeRoute');
This would push middleware to the END of the FULL stack, including the stack listed in the main
app/Http/Kernel.php
. Sodump($kernel)
would reveal the proper orderThis was ideal because at the custom middleware level
Auth::
andSession::
are already fired up.But now in Laravel 5.2 and above, when I
->pushMiddleware
it adds it BEFORE it appends anyapp/Http/Kernel.php
so adump($kernel)
at the provider level looks like soThis means that any custom middleware you want to define from the service provider has no concept of
Session
orAuth
yet.Is there a particular reason for this change?
And I must continue defining the "packages" middleware from the provider as the main laravel app cannot be modified by the users. This is a CMS, so all must be defined in the package.
This is somewhat related to #15072 in how
Auth
has moved around but is NOT the same issue, so please don't disregard as "closed".The text was updated successfully, but these errors were encountered: