Try to remove web
middleware if you’re using 5.2.27 or higher. The thing is now Laravel automatically applies web
middleware to all routes inside routes.php
and if you’re trying to add it manually you can get errors.
app/Providers/RouteServiceProvider.php
of the 5.2.27 version now adds web middleware to all routes inside routes.php
:
protected function mapWebRoutes(Router $router)
{
$router->group([
'namespace' => $this->namespace, 'middleware' => 'web',
], function ($router) {
require app_path('Http/routes.php');
});
}