Saturday, December 3, 2016

[Laravel5] index page won't apply middleware on route

The case is about i created a middleware and it works at each page but not the index page, it should make redirection but it shows 404 error when visited.

PROJECT_ROOT\routes\web.php
Route::get   ('/', 'PageController@home');
Firstly, you should  run the command "composer dump-autoload" first and then refresh webpage, check if the problem still exists
composer dump-autoload

If the problem still here, visit your Kernel file (located at PROJECT_ROOT\app\Http\Kernel.php), check have you added your path of middleware to $middleware:


For my case, i missed register that middleware so it's doesn't work, it alright now.

Reference

https://stackoverflow.com/questions/31418662/laravels-middleware-not-working-on-controller

No comments :

Post a Comment