@@ -26,20 +26,20 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function index(Tournament $tournament) |
| 28 | 28 | { |
| 29 | - $tournament = Tournament::with(['championships' => function ($query) { |
|
| 29 | + $tournament = Tournament::with(['championships' => function($query) { |
|
| 30 | 30 | $query->with('teams') |
| 31 | - ->whereHas('category', function ($subquery) { |
|
| 31 | + ->whereHas('category', function($subquery) { |
|
| 32 | 32 | $subquery->where('isTeam', '=', 1); |
| 33 | 33 | }); |
| 34 | 34 | }])->withCount('competitors', 'teams') |
| 35 | 35 | ->find($tournament->id); |
| 36 | 36 | |
| 37 | 37 | |
| 38 | - $arrChampionshipsWithTeamsAndCompetitors = $tournament->championships->map(function ($championship) { |
|
| 39 | - $competitors = $championship->competitors->load('user')->map(function ($competitor) { |
|
| 38 | + $arrChampionshipsWithTeamsAndCompetitors = $tournament->championships->map(function($championship) { |
|
| 39 | + $competitors = $championship->competitors->load('user')->map(function($competitor) { |
|
| 40 | 40 | return ["id" => $competitor->id, "name" => $competitor->user->name]; |
| 41 | 41 | })->toArray(); |
| 42 | - $teams = $championship->teams()->with('competitors.user')->select('id','name')->get()->toArray(); |
|
| 42 | + $teams = $championship->teams()->with('competitors.user')->select('id', 'name')->get()->toArray(); |
|
| 43 | 43 | $tempAssignCompatitors = new Collection(); |
| 44 | 44 | $assignedCompetitors = $this->getAssignedCompetitors($championship, $tempAssignCompatitors); |
| 45 | 45 | $freeCompetitors = $championship->competitors; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | private function getAssignedCompetitors($championship, $tempAssignCompatitors) |
| 68 | 68 | { |
| 69 | - return $championship->teams->reduce(function ($acc, $team) use ($tempAssignCompatitors) { |
|
| 69 | + return $championship->teams->reduce(function($acc, $team) use ($tempAssignCompatitors) { |
|
| 70 | 70 | return $tempAssignCompatitors->push($team->competitors()->with('user')->get())->collapse(); |
| 71 | 71 | }); |
| 72 | 72 | } |