Merge branch 'feature/eloquent_model_detection' into staging

This commit is contained in:
Shawn McCool 2012-05-28 11:31:45 +02:00
commit 4389e5fa46
2 changed files with 24 additions and 5 deletions

View File

@ -107,10 +107,6 @@ abstract public function attempt($arguments = array());
*/
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->store($token);

View File

@ -15,7 +15,30 @@ public function retrieve($id)
if (filter_var($id, FILTER_VALIDATE_INT) !== false)
{
return $this->model()->find($id);
}
}
}
/**
* 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;
}
/**