Commit ffa9c799 by Dayle Rees Committed by Shawn McCool

added ability to pass eloquent model to Auth::login()

Signed-off-by: Dayle Rees <thepunkfan@gmail.com>
parent ed16bebc
...@@ -5,6 +5,7 @@ use Laravel\Cookie; ...@@ -5,6 +5,7 @@ use Laravel\Cookie;
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 {
...@@ -100,12 +101,16 @@ abstract class Driver { ...@@ -100,12 +101,16 @@ abstract class Driver {
* *
* The token is typically a numeric ID for the user. * The token is typically a numeric ID for the user.
* *
* @param string $token * @param mixed $token
* @param bool $remember * @param bool $remember
* @return bool * @return bool
*/ */
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->id;
$this->token = $token; $this->token = $token;
$this->store($token); $this->store($token);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment