我正在使用 Laravel 5.2,安装了全新的 Sentinel 2.0,注册工作正常,但尝试登录会返回用户,但没有设置任何 cookie 或会话或任何东西..
更新1
此时我发现没有保存任何 cookie/会话。我真的不知道为什么不推送 cookie。
AuthController.php
namespace App\Modules\Auth\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class AuthController extends Controller {
public function getLogin() {
return view("Auth::login");
}
public function postLogin(Request $request) {
$credentials = [
'email' => $request->input('login_email'),
'password' => $request->input('login_password'),
];
if (\Sentinel::authenticate($credentials)) {
return redirect('core/dashboard');
}
}
}
\Sentinel::check();
重定向前的 var_dump()
object(Cartalyst\Sentinel\Users\EloquentUser)#188 (27) {
["table":protected]=>
string(5) "users"
["fillable":protected]=>
array(5) {
[0]=>
string(5) "email"
[1]=>
string(8) "password"
[2]=>
string(9) "last_name"
[3]=>
string(10) "first_name"
[4]=>
string(11) "permissions"
}
["persistableKey":protected]=>
string(7) "user_id"
["persistableRelationship":protected]=>
string(12) "persistences"
["loginNames":protected]=>
array(1) {
[0]=>
string(5) "email"
}
["connection":protected]=>
NULL
["primaryKey":protected]=>
string(2) "id"
["perPage":protected]=>
int(15)
["incrementing"]=>
bool(true)
["timestamps"]=>
bool(true)
["attributes":protected]=>
array(9) {
["id"]=>
int(1)
["email"]=>
string(25) "test@dev.local"
["password"]=>
string(60) "$2y$10$wXHwd6ubbHWWXU9CBI/7AOdDsHY.f7t8b1Kjem0m1ep7Ud.9M/4i6"
["permissions"]=>
NULL
["last_login"]=>
object(Carbon\Carbon)#192 (3) {
["date"]=>
string(26) "2016-01-06 15:15:42.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}
有什么想法会出错吗?
在.env
会话驱动程序中设置为database
,并且会话表在登录后保持为空。也没有设置cookie。