/**
  * Show the form for creating a new resource.
  *
  * @return array
  */
 public function getCurrentRound()
 {
     if (Session::has('admin') || Session::has('user')) {
         $GameController = new GameController();
         $FighterController = new FighterController();
         $round = DB::table('rounds')->where('idgame', '=', Input::get('game'))->where('status', '=', 0)->first();
         if (!$round) {
             if (Session::has('admin')) {
                 $round = DB::table('rounds')->where('idgame', '=', Input::get('game'))->where('status', '=', 1)->first();
                 if (!$round) {
                     $lastRound = DB::table('rounds')->where('idgame', '=', Input::get('game'))->orderBy('idround', 'desc')->first();
                     if (!$lastRound) {
                         $lastRound = 1;
                     } else {
                         $lastRound = $lastRound->round + 1;
                     }
                     $round_id = DB::table('rounds')->insertGetId(array('idgame' => Input::get('game'), 'round' => $lastRound, 'status' => 0));
                     $GameController->change_status(Input::get('game'), 1);
                     $round = DB::table('rounds')->where('idgame', '=', Input::get('game'))->where('status', '=', 0)->first();
                     $game = $GameController->getGameById(Input::get('game'));
                     $fighters = $FighterController->get_all(Input::get('game'), $game->status);
                     return array('round' => $round, 'game' => $game, 'fighters' => $fighters);
                 } else {
                     return array('round' => $round, 'inBattle' => 1);
                 }
             } else {
                 return array('wait' => 1);
             }
         } else {
             $game = $GameController->getGameById(Input::get('game'));
             $fighters = $FighterController->get_all(Input::get('game'), $game->status);
             $action = '';
             $action2 = false;
             if (Session::has('user')) {
                 $user = Session::get('user');
                 $response = DB::table('actions')->where('iduser', '=', $user->iduser)->where('idgame', '=', Input::get('game'))->where('idround', '=', $round->round)->get();
                 $len = count($response);
                 if ($len > 0) {
                     $action = $response[0];
                     if (isset($response[1])) {
                         $action2 = $response[1];
                     }
                 }
             }
             if ($action2) {
                 return array('round' => $round, 'game' => $game, 'fighters' => $fighters, 'action' => $action, 'action2' => $action2);
             }
             return array('round' => $round, 'game' => $game, 'fighters' => $fighters, 'action' => $action);
         }
     } else {
         return 'not admin';
     }
 }