first(); if ( ! is_null($user)) { // ----------------------------------------------------- // Hash the password. If a salt is present on the user // record, we will recreate the hashed password using // the salt. Otherwise, we will just use a plain hash. // ----------------------------------------------------- $password = (isset($user->salt)) ? Hash::make($password, $user->salt)->value : sha1($password); if ($user->password === $password) { static::$user = $user; Session::put(static::$key, $user->id); return true; } } return false; } /** * Logout the current user of the application. * * @return void */ public static function logout() { // ----------------------------------------------------- // By removing the user ID from the session, the user // will no longer be considered logged in on subsequent // requests to the application. // ----------------------------------------------------- Session::forget(static::$key); static::$user = null; } /** * Get the authentication model. * * @return string */ private static function model() { return '\\'.Config::get('auth.model'); } }