public function fetchAccountsPresence($accounts) { $client = new GuzzleClient(['base_uri' => XboxConstants::$getBaseXboxAPI]); // Set up getCommands $requests = array(); foreach ($accounts as $account) { if ($account->xuid == null) { $destiny = new DestinyClient(); $account = $destiny->fetchAccountData($account); } $url = sprintf(XboxConstants::$getPresenceUrl, $account->xuid); $requests[$account->seo] = $client->getAsync($url, ['headers' => ['X-AUTH' => env('XBOXAPI_KEY')]]); } $results = GuzzlePromise\Unwrap($requests); return $results; }
public function validateMottoContains($attribute, $value, $parameters) { $account = $this->getAccount($value); $user = \Auth::user(); if ($account instanceof Account && $user instanceof User) { $client = new Client(); $json = $client->getBungieProfile($account); if ($json != null && str_contains($json['about'], $user->google_id)) { return true; } } return false; }
public function postAddDestinyGame(AddGameRequest $request) { $client = new DestinyClient(); $client->updateTypeOfGame($request->request->get('instanceId'), $request->request->get('type'), $request->request->get('raidTuesday')); return \Redirect::action('UserCpController@getIndex')->with('flash_message', ['type' => 'success', 'header' => 'Game Added!']); }
/** * Execute the command. * * @return void */ public function handle() { $client = new Client(); $account = $client->fetchAccountByGamertag($this->type, $this->gamertag); $client->fetchAccountData($account); }
public function postAddGame() { $all = $this->request->all(); if (isset($all['google_id'])) { try { $user = User::where('google_id', $all['google_id'])->where('admin', true)->firstOrFail(); $client = new Client(); try { $game = $client->fetchGameByInstanceId($all['instanceId']); } catch (GameNotFoundException $e) { return $this->_error('Game could not be found'); } $client->updateTypeOfGame($all['instanceId'], Types::getProperFormat($all['type']), $all['passageId']); return Response::json(['error' => false, 'msg' => 'Game Added! '], 200); } catch (ModelNotFoundException $e) { return $this->_error('User account could not be found.'); } } }
/** * Execute the command. * * @return void */ public function handle() { $client = new Client(); $client->fetchAccountData($this->account); }