Esempio n. 1
0
 public function validateGameExistsReal($attribute, $value, $parameters)
 {
     try {
         $game = Game::where('instanceId', $value)->firstOrFail();
     } catch (ModelNotFoundException $e) {
         return false;
     }
     return true;
 }
Esempio n. 2
0
 /**
  * @param $instanceId
  * @return bool
  * @throws Helpers\Network\BungieOfflineException
  */
 public function updateGame($instanceId)
 {
     try {
         $game = Game::where('instanceId', $instanceId)->firstOrFail();
         $url = sprintf(Constants::$postGameCarnageReport, $instanceId);
         $json = $this->getJson($url);
         $this->updateGameForNewField($json, $game);
     } catch (ModelNotFoundException $e) {
         return false;
     }
 }
Esempio n. 3
0
 public function postComment(AddCommentRequest $request)
 {
     $game = Game::where('instanceId', $request->get('game_id'))->first();
     $membershipId = $this->user->account->destiny->membershipId;
     $comment = new Comment();
     $comment->comment = $request->get('message');
     $comment->membershipId = $membershipId;
     $comment->characterId = $game->findAccountViaMembershipId($membershipId, false)->characterId;
     $comment->parent_comment_id = 0;
     $game->comments()->save($comment);
     return response()->json(['flag' => true, 'url' => \URL::action('Destiny\\GameController@getGame', $game->instanceId)]);
 }
Esempio n. 4
0
 public function postToggleGameVisibility(deleteGameRequest $request)
 {
     try {
         $game = Game::where('instanceId', $request->get('game_id'))->firstOrFail();
         $game->hidden = !$game->hidden;
         $game->save();
         if ($game->hidden) {
             $msg = 'Game was hidden from public.';
         } else {
             $msg = 'Game is now visible to public';
         }
         return \Redirect::action('Destiny\\GameController@getGame', array($request->get('game_id')))->with('flash_message', ['type' => 'green', 'header' => 'Game Visibility Toggled!', 'close' => true, 'body' => $msg]);
     } catch (ModelNotFoundException $e) {
         return \Redirect::action('Destiny\\GameController@getIndex');
     }
 }