8000 Merge pull request #858 from franzliedke/patch-14 · allforweb/laravel@5b14091 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5b14091

Browse files
committed
Merge pull request laravel#858 from franzliedke/patch-14
[Auth] Eloquent driver does now allow login via object
2 parents 46f68ab + 0f5de55 commit 5b14091

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

laravel/auth/drivers/eloquent.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,20 @@ class Eloquent extends Driver {
77
*
88
* If the user is a guest, null should be returned.
99
*
10-
* @param int $id
10+
* @param int|object $token
1111
* @return mixed|null
1212
*/
13-
public function retrieve($id)
13+
public function retrieve($token)
1414
{
15-
if (filter_var($id, FILTER_VALIDATE_INT) !== false)
15+
// We return an object here either if the passed token is an integer (ID)
16+
// or if we are passed a model object of the correct type
17+
if (filter_var($token, FILTER_VALIDATE_INT) !== false)
1618
{
17-
return $this->model()->find($id);
19+
return $this->model()->find($token);
20+
}
21+
else if (get_class($token) == Config::get('auth.model'))
22+
{
23+
return $token;
1824
}
1925
}
2026

0 commit comments

Comments
 (0)
0