Out of the box, Laravel comes with web and api middleware groups that contain common middleware that you might want to apply to your web UIs and APIs.
If you check your app/Providers/RouteServiceProvider.php , you will find that the routes/web.php group web is used by default for all your routes in routes/web.php .
protected function mapWebRoutes() { Route::group([ 'middleware' => 'web', 'namespace' => $this->namespace, ], function ($router) { require base_path('routes/web.php'); }); }
Now, if you go, check your app/Http/Kernel.php and take a look at the $middlewareGroups property, you will find the new EncryptCookies . You can read about it, but if you remove this middleware from the web middleware group, your application may not provide the TokenMismatchException that you are currently receiving.
source share