流明会议不起作用

时间:2015-05-22 11:15:42

标签: session authentication lumen

我有一个简单的身份验证系统here

我有Auth::attempt工作,以检查用户的凭据是否正常。我从Auth::user()收回了用户。

if (Auth::attempt(array('email' => $email, 'password' => $password),true)) {
    // everything is fine and user is logged
    return view('login', ['user' => Auth::user()]);
}

然后,如果我在另一个控制器中尝试Auth::check(),则会始终返回 false

我发现我的会话无法正常工作。像put或get描述的简单事情here

那么如何激活流明使用的会话?

我使用的是nginx + php-fpm。

我在nginx/error.loglumen.log上没有错误。

由于

1 个答案:

答案 0 :(得分:2)

bootstrap/app.php中,请确保您没有注释这些行:

/*
|--------------------------------------------------------------------------
| Register Middleware
|--------------------------------------------------------------------------
|
| Next, we will register the middleware with the application. These can
| be global middleware that run before and after each request into a
| route or middleware that'll be assigned to some specific routes.
|
*/

$app->middleware([
    'Illuminate\Cookie\Middleware\EncryptCookies',
    'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse',
    'Illuminate\Session\Middleware\StartSession',
    'Illuminate\View\Middleware\ShareErrorsFromSession',
    'Laravel\Lumen\Http\Middleware\VerifyCsrfToken',
]);