first(); if ( ! is_null($user)) { // ----------------------------------------------------- // Hash the password. // ----------------------------------------------------- $password = (isset($user->salt)) ? Hash::make($password, $user->salt)->value : sha1($password); // ----------------------------------------------------- // Verify that the passwords match. // ----------------------------------------------------- if ($user->password == $password) { // ----------------------------------------------------- // Set the user property. // ----------------------------------------------------- static::$user = $user; // ----------------------------------------------------- // Store the user ID in the session. // ----------------------------------------------------- Session::put(static::$key, $user->id); return true; } } return false; } /** * Logout the current user of the application. * * @return void */ public static function logout() { // ----------------------------------------------------- // Remove the user ID from the session. // ----------------------------------------------------- Session::forget(static::$key); // ----------------------------------------------------- // Clear the current user variable. // ----------------------------------------------------- static::$user = null; } /** * Get the authentication model. * * @return string */ private static function model() { return '\\'.Config::get('auth.model'); } }