/** * Try get saved user by cookie * Saves lastVisit time of user * * @return boolean */ private static function signByCookies() { if (!($hash = Request::cookie('user_key'))) { return false; } if ($user = Models\User::findByCookie($hash, Request::clientIP())) { $_SESSION['logined_user'] = get_object_vars($user); self::$model = $user; self::$id = $user->id; self::$name = $user->name; $user->lastVisit = Timer::now(); $user->save(['lastVisit']); return self::$signed = true; } return false; }