Commit 0d2cfd24 authored by Taylor Otwell's avatar Taylor Otwell

Refactor Auth class to use Auth config closures.

parent 9ec8f4a5
...@@ -42,7 +42,7 @@ class Auth { ...@@ -42,7 +42,7 @@ class Auth {
if (is_null(static::$user) and Session::has(static::$key)) if (is_null(static::$user) and Session::has(static::$key))
{ {
static::$user = forward_static_call(array(static::model(), 'find'), Session::get(static::$key)); static::$user = call_user_func(Config::get('auth.by_id'), Session::get(static::$key));
} }
return static::$user; return static::$user;
...@@ -59,9 +59,7 @@ class Auth { ...@@ -59,9 +59,7 @@ class Auth {
*/ */
public static function login($username, $password) public static function login($username, $password)
{ {
$user = forward_static_call(array(static::model(), 'where'), Config::get('auth.username'), '=', $username)->first(); if ( ! is_null($user = call_user_func(Config::get('auth.by_username'), $username)))
if ( ! is_null($user))
{ {
if (Hash::check($password, $user->password)) if (Hash::check($password, $user->password))
{ {
...@@ -88,14 +86,4 @@ class Auth { ...@@ -88,14 +86,4 @@ class Auth {
static::$user = null; static::$user = null;
} }
/**
* Get the authentication model.
*
* @return string
*/
private static function model()
{
return '\\'.Config::get('auth.model');
}
} }
\ No newline at end of file
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