コード例 #1
0
 public function postGamertagOwnership(OwnershipFormRequest $request)
 {
     $account = Account::where('seo', Text::seoGamertag($request->request->get('gamertag')))->first();
     $this->user->account_id = $account->id;
     $this->user->save();
     return \Redirect::action('UserCpController@getIndex')->with('flash_message', ['header' => 'Gamertag Verified!', 'close' => true, 'body' => 'You have proved ownership of <strong>' . $account->gamertag . '</strong>.']);
 }
コード例 #2
0
 public function checkForUpdate($gamertag = '')
 {
     if ($this->request->ajax() && !\Agent::isRobot()) {
         try {
             $account = Account::with('destiny.characters')->where('seo', Text::seoGamertag($gamertag))->firstOrFail();
             // We don't care about non-panda members
             if (!$account->isPandaLove()) {
                 $this->inactiveCounter = 1;
             }
             // check for 10 inactive checks
             if ($account->destiny->inactiveCounter >= $this->inactiveCounter) {
                 return response()->json(['updated' => false, 'frozen' => true, 'last_update' => 'This account hasn\'t had new data in awhile. - <a href="' . URL::action('Destiny\\ProfileController@manualUpdate', [$account->seo]) . '" class="ui  horizontal green label no_underline">Update Manually</a>']);
             }
             $char = $account->destiny->firstCharacter();
             if ($char->updated_at->diffInMinutes() >= $this->refreshRateInMinutes) {
                 // update this
                 $this->dispatch(new UpdateAccount($account));
                 return response()->json(['updated' => true, 'frozen' => false, 'last_update' => $char->getLastUpdatedRelative()]);
             }
             return response()->json(['updated' => false, 'frozen' => false, 'last_update' => $char->getLastUpdatedRelative()]);
         } catch (ModelNotFoundException $e) {
             return response()->json(['error' => 'Gamertag not found']);
         }
     }
 }
コード例 #3
0
 public function getGrimoire($gamertag)
 {
     try {
         $account = Account::with('destiny.characters')->where('seo', Text::seoGamertag($gamertag))->firstOrFail();
         $msg = '<strong>' . $account->gamertag . "</strong><br/><br />Grimoire: ";
         $msg .= $account->destiny->grimoire;
         if ($account->destiny->getOriginal('grimoire') == self::MAX_GRIMOIRE) {
             $msg .= "<strong> [MAX]</strong>";
         }
         return Response::json(['error' => false, 'msg' => $msg], 200);
     } catch (ModelNotFoundException $e) {
         return $this->_error('Gamertag not found');
     }
 }
コード例 #4
0
ファイル: Client.php プロジェクト: GMSteuart/PandaLove
 /**
  * @param $gamertag
  * @return \Onyx\Account|void
  */
 private function checkCacheForGamertag($gamertag)
 {
     $account = Account::where('seo', DestinyText::seoGamertag($gamertag))->first();
     if ($account instanceof Account) {
         return $account;
     }
     return false;
 }
コード例 #5
0
 /**
  * @param $gamertag
  * @return mixed
  */
 private function getAccount($gamertag)
 {
     $lowercase = Text::seoGamertag($gamertag);
     return Account::where('seo', $lowercase)->first();
 }
コード例 #6
0
ファイル: Account.php プロジェクト: GMSteuart/PandaLove
 public function setGamertagAttribute($value)
 {
     $this->attributes['gamertag'] = $value;
     $this->attributes['seo'] = Text::seoGamertag($value);
 }