client = new Client(['verify' => false]); } public function checkHasVoted(): bool { if (! config('habbo.findretros.enabled')) { return true; } $ip = request()->ip(); if ($ip === '127.0.0.1') { return true; } if (request()->has('novote')) { return true; } $cacheKey = sprintf(self::FIND_RETROS_CACHE_KEY, $ip); if (Cache::has($cacheKey)) { return true; } $uri = sprintf( self::FIND_RETROS_VERIFY_URI, config('habbo.findretros.api'), config('habbo.findretros.name'), $ip, ); $request = $this->client->get($uri); $response = $request->getBody()->getContents(); if (in_array($response, ['1', '2'], true)) { Cache::put($cacheKey, true, now()->addMinutes(30)); return true; } return false; } public function getRedirectUri(): string { return sprintf( self::FIND_RETROS_REDIRECT_URI, config('habbo.findretros.api'), config('habbo.findretros.name'), ); } }