Merge branch 'hotfix/auth_login_eloquent_driver' into develop
This commit is contained in:
commit
22f99bce1f
|
@ -5,7 +5,6 @@
|
||||||
use Laravel\Config;
|
use Laravel\Config;
|
||||||
use Laravel\Session;
|
use Laravel\Session;
|
||||||
use Laravel\Crypter;
|
use Laravel\Crypter;
|
||||||
use Laravel\Database\Eloquent\Model as Eloquent;
|
|
||||||
|
|
||||||
abstract class Driver {
|
abstract class Driver {
|
||||||
|
|
||||||
|
@ -107,10 +106,6 @@ abstract public function attempt($arguments = array());
|
||||||
*/
|
*/
|
||||||
public function login($token, $remember = false)
|
public function login($token, $remember = false)
|
||||||
{
|
{
|
||||||
// if the token is an Eloquent model
|
|
||||||
// set the token from the id field
|
|
||||||
if ($token instanceof Eloquent) $token = $token->get_key();
|
|
||||||
|
|
||||||
$this->token = $token;
|
$this->token = $token;
|
||||||
|
|
||||||
$this->store($token);
|
$this->store($token);
|
||||||
|
|
|
@ -43,6 +43,29 @@ public function attempt($arguments = array())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Login the user assigned to the given token.
|
||||||
|
*
|
||||||
|
* The token is typically a numeric ID for the user.
|
||||||
|
*
|
||||||
|
* @param mixed $token
|
||||||
|
* @param bool $remember
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function login($token, $remember = false)
|
||||||
|
{
|
||||||
|
// if the token is an Eloquent model get the primary key
|
||||||
|
if ($token instanceof \Eloquent) $token = $token->get_key();
|
||||||
|
|
||||||
|
$this->token = $token;
|
||||||
|
|
||||||
|
$this->store($token);
|
||||||
|
|
||||||
|
if ($remember) $this->remember($token);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a fresh model instance.
|
* Get a fresh model instance.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue