这样我将用户信息存储到DB:
$user = new User;
$user->email = $arr['email'];
$user->nick = $arr['display'];
$user->ip = Request::getClientIp();
$user->save();
并且它可以很好地工作但是在save()
方法之后我将以这种方式登录用户:
Auth::login($user);
它永远不会导致真实的情况。然后当我转储$user
:
object(User)#179 (20) {
["connection":protected]=>
NULL
["table":protected]=>
NULL
["primaryKey":protected]=>
string(2) "id"
["perPage":protected]=>
int(15)
["incrementing"]=>
bool(true)
["timestamps"]=>
bool(true)
["attributes":protected]=>
array(6) {
["email"]=>
string(19) "myemail@gmail.com"
["nick"]=>
string(17) "my_name"
["ip"]=>
string(9) "127.0.0.1"
["updated_at"]=>
string(19) "2014-01-25 09:48:07"
["created_at"]=>
string(19) "2014-01-25 09:48:07"
["id"]=>
int(13)
}
.
.
.
然后我尝试了这个:
Auth::loginUsingId($user->original['id']);
实际上$user->original['id']
不会返回NULL
!
非常感谢!