Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 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!']);
 }
Ejemplo n.º 4
0
 /**
  * Execute the command.
  *
  * @return void
  */
 public function handle()
 {
     $client = new Client();
     $account = $client->fetchAccountByGamertag($this->type, $this->gamertag);
     $client->fetchAccountData($account);
 }
Ejemplo n.º 5
0
 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.');
         }
     }
 }
Ejemplo n.º 6
0
 /**
  * Execute the command.
  *
  * @return void
  */
 public function handle()
 {
     $client = new Client();
     $client->fetchAccountData($this->account);
 }