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

Register Middleware Global #846

letuananh1873 opened this issue Oct 5, 2019 · 1 comment


Copy link

commented Oct 5, 2019

Path: \Modules\Page\Http\Middleware\LanguageMiddleware::class in class I echo "Hello!"; die();

When I add this path via app\Http\kernel.php, it's working, show text "Hello!" ->

But when I register via Modules/Page/Providers/PageServiceProvider.php
$router->aliasMiddleware('LanguageMiddleware', \Modules\Page\Http\Middleware\LanguageMiddleware::class);

It's not working, not show text "Hello!" ->


Please help me.
Thank you so much!


This comment has been minimized.

Copy link

commented Oct 5, 2019


I'm not sure you can register global middlewares anywhere.
You probably have to register in app/http/kernel.php, or define your own kernel.php.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.