Ejemplo n.º 1
0
 public function validateGameReal($attribute, $value, $parameters)
 {
     $client = new Client();
     try {
         $game = $client->fetchGameByInstanceId($value);
     } catch (GameNotFoundException $e) {
         return false;
     }
     return true;
 }
Ejemplo n.º 2
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.');
         }
     }
 }