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

Closed
letuananh1873 opened this issue Oct 5, 2019 · 1 comment

Comments

@letuananh1873
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!" -> https://gyazo.com/e59af775fd3f59f1fbf7f3147c6d01a4

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!" -> https://gyazo.com/32df2073235f8a1e8cb7d53feea0459e

#175

Please help me.
Thank you so much!

@nWidart

This comment has been minimized.

Copy link
Owner

commented Oct 5, 2019

Hi,

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
Projects
None yet
2 participants
You can’t perform that action at this time.