public static function pagination($id)
 {
     $data = Group::where('challenge_id', '=', $id)->get()->toArray();
     for ($i = 0; $i <= count($data) - 1; $i++) {
         $dr = Groupsta::where('group_id', '=', $data[$i]['id'])->join('rb_rounds', 'rb_rounds.id', '=', 'rb_group_stage.round_id')->join('rb_team', 'rb_team.id', '=', 'rb_rounds.team_id')->select('rb_rounds.*', 'rb_team.name as nombre_equipo', 'rb_team.name_altered as nombre_alterno', 'rb_team.gender as genero', 'rb_group_stage.id as id_g_s')->get()->toArray();
         $data[$i]['data_team'] = [];
         $data[$i]['data_team'] += $dr;
     }
     return $data;
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public static function index($id)
 {
     $data = Con::pagination($id);
     $challenge = Challenge::find($id);
     $challenge_name = $challenge->name;
     foreach ($data as $d) {
         $data = Groupsta::where('group_id', '=', $d['id'])->select('round_id')->get()->toArray();
         $arrayBuild = CombatRoundController::buildArray($data);
         $valore = CombatRoundController::funPru($arrayBuild);
         $dataGroup = Group::find($d['id']);
         foreach ($valore as $val) {
             $dat = CombatRound::where('group_id', '=', $d['id'])->where('versus_one', '=', $val['0'])->where('versus_two', '=', $val['1'])->where('challenge_id', '=', $id)->get();
             if (count($dat) <= 0) {
                 CombatRound::create(['group_id' => $d['id'], 'stage_id' => $dataGroup->stage_id, 'versus_one' => $val['0'], 'versus_two' => $val['1'], 'challenge_id' => $d['challenge_id']]);
             }
         }
     }
     $data = CombatRoundController::getRoundInfo($id);
     if (!ENV('DEVELOP')) {
         return view('combatround.index', compact('data', 'challenge_name'));
     }
 }