/** * Display a listing of the resource. * * @return Response */ public static function index($id, array $data = ['y' => 0]) { $challenge = Challenge::find($id); $challenge_name = $challenge->name; $group = Group::where('challenge_id', '=', $id)->get()->toArray(); $teamRound = Round::where('challenge_id', '=', $id)->orderBy('team_id', 'DESC')->get()->toArray(); $countTeamRound = count($teamRound); $countGroup = count($group) + $data['y']; $div = $countTeamRound / $countGroup; $p = 0; for ($i = $data['y']; $i <= count($teamRound) - 1; $i++) { if (!Groupsta::where('round_id', '=', $teamRound[$i]['id'])->first()) { Groupsta::create(['round_id' => $teamRound[$i]['id'], 'group_id' => $group[$p]['id'], 'challenge_id' => $id]); } if ($i == $countGroup - 1) { GroupstaController::index($id, $data = ['y' => $i + 1]); break; } $p++; } if (!ENV('DEVELOP')) { $data = GroupstaController::pagination($id); $dataG = []; $dataG += ['' => '-- Seleciona Grupo --']; $datagro = Group::where('challenge_id', '=', $id)->lists('name', 'id')->toArray(); $dataG += $datagro; return view('groupsstage.index', compact('data', 'challenge_name', 'dataG')); } }
/** * Run the database seeds. * * @return void */ public function run() { Group::index(1); Group::index(2); Group::index(3); Group::index(4); Group::index(5); Group::index(7); Group::index(8); }
/** * 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')); } }