它在5.2版本中发生了变化。
如果您将使用session、csrf、cookie ext.,那么您应该在路由中使用这样的“web”中间件:
Route::group(['middleware' => ['web']], function () {
//
});
您可以在项目中看到新内核。php文件如下:
/**
* The application's route middleware groups.
*
* @var array
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
],
'api' => [
'throttle:60,1',
],
];
更多信息:
https://laravel.com/docs/5.2/releases