After updating Laravel version from 6.0 to 8.0, the middleware pushed using $router->pushMiddlewareToGroup is not working.
//add language middleware to the web group
$router->pushMiddleWareToGroup('web',Language::class);
After updating Laravel version from 6.0 to 8.0, the middleware pushed using $router->pushMiddlewareToGroup is not working.
//add language middleware to the web group
$router->pushMiddleWareToGroup('web',Language::class);
Copyright © 2021 Jogjafile Inc.
Did you wrap the code in
booted?I faced the same issue and it was resolved only after calling
pushMiddleWareToGroupinbooted. You might also want to set the loading priority usingprotected $middlewarePriority = [...];inApp\Http\Kernel.php