@@ -14,25 +14,25 @@ |
||
14 | 14 | $tournament = null; |
15 | 15 | if (FightersGroup::hasTournamentInRequest($request)) { |
16 | 16 | $tournamentSlug = $request->tournament; |
17 | - $tournament = Tournament::with(['championships' => function ($query) use ($request) { |
|
17 | + $tournament = Tournament::with(['championships' => function($query) use ($request) { |
|
18 | 18 | $query->with([ |
19 | 19 | 'settings', |
20 | 20 | 'category', |
21 | - 'fightersGroups' => function ($query) { |
|
21 | + 'fightersGroups' => function($query) { |
|
22 | 22 | return $query->with('teams', 'competitors', 'fights'); |
23 | 23 | }]); |
24 | 24 | }])->withCount('competitors', 'teams') |
25 | 25 | ->where('slug', $tournamentSlug)->firstOrFail(); |
26 | 26 | } elseif (FightersGroup::hasChampionshipInRequest($request)) { |
27 | - $tournament = Tournament::whereHas('championships', function ($query) use ($request) { |
|
27 | + $tournament = Tournament::whereHas('championships', function($query) use ($request) { |
|
28 | 28 | return $query->where('id', $request->championshipId); |
29 | 29 | }) |
30 | - ->with(['championships' => function ($query) use ($request) { |
|
30 | + ->with(['championships' => function($query) use ($request) { |
|
31 | 31 | $query->where('id', '=', $request->championshipId) |
32 | 32 | ->with([ |
33 | 33 | 'settings', |
34 | 34 | 'category', |
35 | - 'fightersGroups' => function ($query) { |
|
35 | + 'fightersGroups' => function($query) { |
|
36 | 36 | return $query->with('teams', 'competitors', 'fights'); |
37 | 37 | }]); |
38 | 38 | }]) |
@@ -51,12 +51,12 @@ discard block |
||
51 | 51 | protected static function boot() |
52 | 52 | { |
53 | 53 | parent::boot(); |
54 | - static::deleting(function ($tournament) { |
|
54 | + static::deleting(function($tournament) { |
|
55 | 55 | $tournament->championships->each->delete(); |
56 | 56 | $tournament->invites->each->delete(); |
57 | 57 | |
58 | 58 | }); |
59 | - static::restoring(function ($tournament) { |
|
59 | + static::restoring(function($tournament) { |
|
60 | 60 | $tournament->championships()->withTrashed()->get()->each->restore(); |
61 | 61 | }); |
62 | 62 | |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | public function buildCategoryList() |
362 | 362 | { |
363 | 363 | $championships = Championship::with('category', 'settings') |
364 | - ->whereHas('category', function ($query) { |
|
364 | + ->whereHas('category', function($query) { |
|
365 | 365 | return $query->where('isTeam', 1); |
366 | 366 | }) |
367 | 367 | ->where('tournament_id', $this->id) |
@@ -114,7 +114,7 @@ |
||
114 | 114 | return $query->where('federation_id', $user->federationOwned->id); |
115 | 115 | case |
116 | 116 | $user->isAssociationPresident() && $user->associationOwned: |
117 | - return $query->whereHas('association', function ($query) use ($user) { |
|
117 | + return $query->whereHas('association', function($query) use ($user) { |
|
118 | 118 | $query->where('id', $user->associationOwned->id); |
119 | 119 | }); |
120 | 120 | case $user->isClubPresident() && $user->clubOwned: |
@@ -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 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | * @return mixed |
18 | 18 | */ |
19 | 19 | |
20 | - protected $languages = ['en', 'es', 'ja', 'fr','de']; |
|
20 | + protected $languages = ['en', 'es', 'ja', 'fr', 'de']; |
|
21 | 21 | |
22 | 22 | |
23 | 23 | public function handle($request, Closure $next) |
@@ -3,111 +3,111 @@ discard block |
||
3 | 3 | // Home |
4 | 4 | use Illuminate\Support\Facades\Auth; |
5 | 5 | |
6 | -Breadcrumbs::register('dashboard', function ($breadcrumbs) { |
|
6 | +Breadcrumbs::register('dashboard', function($breadcrumbs) { |
|
7 | 7 | $breadcrumbs->push(trans('core.dashboard'), route('dashboard')); |
8 | 8 | }); |
9 | 9 | |
10 | 10 | // Home > Federations |
11 | -Breadcrumbs::register('federations.index', function ($breadcrumbs) { |
|
11 | +Breadcrumbs::register('federations.index', function($breadcrumbs) { |
|
12 | 12 | $breadcrumbs->parent('dashboard'); |
13 | 13 | $breadcrumbs->push(trans_choice('structures.federation', 2), route('federations.index')); |
14 | 14 | }); |
15 | 15 | |
16 | -Breadcrumbs::register('federations.edit', function ($breadcrumbs, $federation) { |
|
16 | +Breadcrumbs::register('federations.edit', function($breadcrumbs, $federation) { |
|
17 | 17 | $breadcrumbs->parent('federations.index'); |
18 | 18 | if (Auth::user()->isFederationPresident($federation)) { |
19 | - $breadcrumbs->push(str_limit($federation->name,40), route('federations.edit', $federation->id)); |
|
19 | + $breadcrumbs->push(str_limit($federation->name, 40), route('federations.edit', $federation->id)); |
|
20 | 20 | } else { |
21 | - $breadcrumbs->push(str_limit($federation->name,40), route('federations.show', $federation->id)); |
|
21 | + $breadcrumbs->push(str_limit($federation->name, 40), route('federations.show', $federation->id)); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | }); |
25 | 25 | |
26 | 26 | // Home > Associations |
27 | -Breadcrumbs::register('associations.index', function ($breadcrumbs) { |
|
27 | +Breadcrumbs::register('associations.index', function($breadcrumbs) { |
|
28 | 28 | $breadcrumbs->parent('dashboard'); |
29 | 29 | $breadcrumbs->push(trans_choice('structures.association', 2), route('associations.index')); |
30 | 30 | }); |
31 | 31 | |
32 | -Breadcrumbs::register('associations.create', function ($breadcrumbs) { |
|
32 | +Breadcrumbs::register('associations.create', function($breadcrumbs) { |
|
33 | 33 | $breadcrumbs->parent('associations.index'); |
34 | 34 | $breadcrumbs->push(trans('core.addModel', ['currentModelName' => trans_choice('structures.association', 1)]), route('associations.create')); |
35 | 35 | |
36 | 36 | }); |
37 | 37 | |
38 | 38 | |
39 | -Breadcrumbs::register('associations.edit', function ($breadcrumbs, $association) { |
|
39 | +Breadcrumbs::register('associations.edit', function($breadcrumbs, $association) { |
|
40 | 40 | $breadcrumbs->parent('associations.index'); |
41 | 41 | if (Auth::user()->isFederationPresident($association->federation) || Auth::user()->isAssociationPresident($association)) { |
42 | - $breadcrumbs->push(str_limit($association->name,40), route('associations.edit', $association->id)); |
|
42 | + $breadcrumbs->push(str_limit($association->name, 40), route('associations.edit', $association->id)); |
|
43 | 43 | } else { |
44 | - $breadcrumbs->push(str_limit($association->name,40), route('associations.show', $association->id)); |
|
44 | + $breadcrumbs->push(str_limit($association->name, 40), route('associations.show', $association->id)); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | }); |
48 | 48 | |
49 | 49 | // |
50 | 50 | // Home > Clubs |
51 | -Breadcrumbs::register('clubs.index', function ($breadcrumbs) { |
|
51 | +Breadcrumbs::register('clubs.index', function($breadcrumbs) { |
|
52 | 52 | $breadcrumbs->parent('dashboard'); |
53 | 53 | $breadcrumbs->push(trans_choice('structures.club', 2), route('clubs.index')); |
54 | 54 | }); |
55 | 55 | |
56 | -Breadcrumbs::register('clubs.edit', function ($breadcrumbs, $club) { |
|
56 | +Breadcrumbs::register('clubs.edit', function($breadcrumbs, $club) { |
|
57 | 57 | $breadcrumbs->parent('clubs.index'); |
58 | 58 | if (Auth::user()->isFederationPresident($club->federation) || Auth::user()->isAssociationPresident($club) || Auth::user()->isClubPresident($club)) { |
59 | - $breadcrumbs->push(str_limit($club->name,40), route('clubs.edit', $club->id)); |
|
59 | + $breadcrumbs->push(str_limit($club->name, 40), route('clubs.edit', $club->id)); |
|
60 | 60 | } else { |
61 | - $breadcrumbs->push(str_limit($club->name,40), route('clubs.show', $club->id)); |
|
61 | + $breadcrumbs->push(str_limit($club->name, 40), route('clubs.show', $club->id)); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | }); |
65 | 65 | |
66 | 66 | |
67 | 67 | // Home > Tournaments |
68 | -Breadcrumbs::register('tournaments.index', function ($breadcrumbs) { |
|
68 | +Breadcrumbs::register('tournaments.index', function($breadcrumbs) { |
|
69 | 69 | $breadcrumbs->parent('dashboard'); |
70 | 70 | $breadcrumbs->push(trans_choice('core.tournament', 2), route('tournaments.index')); |
71 | 71 | }); |
72 | 72 | |
73 | 73 | |
74 | -Breadcrumbs::register('tournaments.deleted', function ($breadcrumbs) { |
|
74 | +Breadcrumbs::register('tournaments.deleted', function($breadcrumbs) { |
|
75 | 75 | $breadcrumbs->parent('dashboard'); |
76 | 76 | $breadcrumbs->push(trans('core.tournaments_deleted')); |
77 | 77 | }); |
78 | 78 | |
79 | 79 | // Home > Create Tournament |
80 | -Breadcrumbs::register('tournaments.create', function ($breadcrumbs, $currentModelName) { |
|
80 | +Breadcrumbs::register('tournaments.create', function($breadcrumbs, $currentModelName) { |
|
81 | 81 | $breadcrumbs->parent('dashboard'); |
82 | 82 | $breadcrumbs->push(trans('core.createTournament'), route('tournaments.create')); |
83 | 83 | }); |
84 | 84 | |
85 | 85 | // Home > Tournaments > Edit Tournament |
86 | -Breadcrumbs::register('tournaments.edit', function ($breadcrumbs, $tournament) { |
|
86 | +Breadcrumbs::register('tournaments.edit', function($breadcrumbs, $tournament) { |
|
87 | 87 | $breadcrumbs->parent('tournaments.index'); |
88 | 88 | if (policy($tournament)->edit(Auth::user(), $tournament)) { |
89 | 89 | $breadcrumbs->push(str_limit($tournament->name, 30), route('tournaments.edit', $tournament->slug)); |
90 | 90 | } else { |
91 | - $breadcrumbs->push(str_limit($tournament->name,30), route('tournaments.show', $tournament->slug)); |
|
91 | + $breadcrumbs->push(str_limit($tournament->name, 30), route('tournaments.show', $tournament->slug)); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | }); |
95 | -Breadcrumbs::register('tournaments.show', function ($breadcrumbs, $tournament) { |
|
95 | +Breadcrumbs::register('tournaments.show', function($breadcrumbs, $tournament) { |
|
96 | 96 | $breadcrumbs->parent('tournaments.index'); |
97 | - $breadcrumbs->push(str_limit($tournament->name,30), route('tournaments.show', $tournament->slug)); |
|
97 | + $breadcrumbs->push(str_limit($tournament->name, 30), route('tournaments.show', $tournament->slug)); |
|
98 | 98 | |
99 | 99 | }); |
100 | 100 | |
101 | 101 | |
102 | 102 | // Home > Invites |
103 | -Breadcrumbs::register('invites.index', function ($breadcrumbs) { |
|
103 | +Breadcrumbs::register('invites.index', function($breadcrumbs) { |
|
104 | 104 | |
105 | 105 | $breadcrumbs->parent('dashboard'); |
106 | 106 | $breadcrumbs->push(trans_choice('core.invitation', 2), route('invites.index')); |
107 | 107 | }); |
108 | 108 | |
109 | 109 | // Home > Tournaments > MyTournament > Invite Competitors |
110 | -Breadcrumbs::register('invites.show', function ($breadcrumbs, $tournament) { |
|
110 | +Breadcrumbs::register('invites.show', function($breadcrumbs, $tournament) { |
|
111 | 111 | if ($tournament != null) { |
112 | 112 | if (policy($tournament)->edit(Auth::user(), $tournament)) { |
113 | 113 | $breadcrumbs->parent('tournaments.edit', $tournament); |
@@ -121,13 +121,13 @@ discard block |
||
121 | 121 | }); |
122 | 122 | |
123 | 123 | // Home > Tournaments > MyTournament > List Competitors |
124 | -Breadcrumbs::register('tournaments.users.index', function ($breadcrumbs, $tournament) { |
|
124 | +Breadcrumbs::register('tournaments.users.index', function($breadcrumbs, $tournament) { |
|
125 | 125 | $breadcrumbs->parent('tournaments.edit', $tournament); |
126 | 126 | $breadcrumbs->push(trans_choice('core.competitor', 2), action('CompetitorController@index', [$tournament->slug])); |
127 | 127 | }); |
128 | 128 | |
129 | 129 | // Home > Tournaments > MyTournament > Add Competitors |
130 | -Breadcrumbs::register('tournaments.users.create', function ($breadcrumbs, $tournament) { |
|
130 | +Breadcrumbs::register('tournaments.users.create', function($breadcrumbs, $tournament) { |
|
131 | 131 | if (policy($tournament)->edit(Auth::user(), $tournament)) { |
132 | 132 | $breadcrumbs->parent('tournaments.edit', $tournament); |
133 | 133 | } else { |
@@ -137,13 +137,13 @@ discard block |
||
137 | 137 | }); |
138 | 138 | |
139 | 139 | // Home > Tournaments > MyTournament > show Competitor |
140 | -Breadcrumbs::register('tournaments.users.show', function ($breadcrumbs, $tournament, $user) { |
|
140 | +Breadcrumbs::register('tournaments.users.show', function($breadcrumbs, $tournament, $user) { |
|
141 | 141 | $breadcrumbs->parent('tournaments.users.index', $tournament); |
142 | 142 | $breadcrumbs->push($user->name, action('CompetitorController@index', [$tournament->slug, $user->slug])); |
143 | 143 | }); |
144 | 144 | |
145 | 145 | // Home > Edit Profile |
146 | -Breadcrumbs::register('users.edit', function ($breadcrumbs, $user) { |
|
146 | +Breadcrumbs::register('users.edit', function($breadcrumbs, $user) { |
|
147 | 147 | $breadcrumbs->parent('dashboard'); |
148 | 148 | if (policy($user)->edit(Auth::user(), $user)) { |
149 | 149 | if (Auth::user()->name == $user->name) { |
@@ -157,35 +157,35 @@ discard block |
||
157 | 157 | |
158 | 158 | }); |
159 | 159 | |
160 | -Breadcrumbs::register('users.index', function ($breadcrumbs) { |
|
160 | +Breadcrumbs::register('users.index', function($breadcrumbs) { |
|
161 | 161 | $breadcrumbs->parent('dashboard'); |
162 | 162 | $breadcrumbs->push(trans_choice('core.competitor', 2), route('users.index')); |
163 | 163 | }); |
164 | 164 | |
165 | -Breadcrumbs::register('users.create', function ($breadcrumbs) { |
|
165 | +Breadcrumbs::register('users.create', function($breadcrumbs) { |
|
166 | 166 | $breadcrumbs->parent('dashboard'); |
167 | 167 | $breadcrumbs->push(trans('core.add_competitor'), route('users.create')); |
168 | 168 | }); |
169 | 169 | |
170 | -Breadcrumbs::register('users.show', function ($breadcrumbs, $user) { |
|
170 | +Breadcrumbs::register('users.show', function($breadcrumbs, $user) { |
|
171 | 171 | $breadcrumbs->parent('dashboard'); |
172 | 172 | $breadcrumbs->push(trans_choice('core.user', 1), route('users.show', $user->slug)); |
173 | 173 | }); |
174 | 174 | |
175 | -Breadcrumbs::register('users.tournaments', function ($breadcrumbs, $user) { |
|
175 | +Breadcrumbs::register('users.tournaments', function($breadcrumbs, $user) { |
|
176 | 176 | $breadcrumbs->parent('dashboard'); |
177 | 177 | $breadcrumbs->push(trans('core.tournaments_registered'), route('users.tournaments', $user->slug)); |
178 | 178 | |
179 | 179 | |
180 | 180 | }); |
181 | 181 | |
182 | -Breadcrumbs::register('categories.create', function ($breadcrumbs) { |
|
182 | +Breadcrumbs::register('categories.create', function($breadcrumbs) { |
|
183 | 183 | $breadcrumbs->parent('dashboard'); |
184 | 184 | $breadcrumbs->push(trans('core.add_category'), route('categories.create')); |
185 | 185 | }); |
186 | 186 | |
187 | 187 | // Home > Tournaments > MyTournament > List Teams |
188 | -Breadcrumbs::register('teams.index', function ($breadcrumbs, $tournament) { |
|
188 | +Breadcrumbs::register('teams.index', function($breadcrumbs, $tournament) { |
|
189 | 189 | $breadcrumbs->parent('tournaments.edit', $tournament); |
190 | 190 | if (policy($tournament)->edit(Auth::user(), $tournament)) { |
191 | 191 | $breadcrumbs->push(trans_choice('core.team', 2), route('tournaments.edit', $tournament->slug)); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | }); |
197 | 197 | |
198 | 198 | // Home > Tournaments > MyTournament > List Trees |
199 | -Breadcrumbs::register('trees.index', function ($breadcrumbs, $tournament) { |
|
199 | +Breadcrumbs::register('trees.index', function($breadcrumbs, $tournament) { |
|
200 | 200 | if (policy($tournament) != null && policy($tournament)->edit(Auth::user(), $tournament)) { |
201 | 201 | $breadcrumbs->parent('tournaments.edit', $tournament); |
202 | 202 | $breadcrumbs->push(trans_choice('core.tree', 2), route('tournaments.edit', $tournament->slug)); |
@@ -208,17 +208,17 @@ discard block |
||
208 | 208 | }); |
209 | 209 | |
210 | 210 | |
211 | -Breadcrumbs::register('teams.create', function ($breadcrumbs, $tournament) { |
|
211 | +Breadcrumbs::register('teams.create', function($breadcrumbs, $tournament) { |
|
212 | 212 | $breadcrumbs->parent('tournaments.edit', $tournament); |
213 | 213 | $breadcrumbs->push(trans_choice('core.team', 2), route('teams.index', $tournament->slug)); |
214 | 214 | }); |
215 | -Breadcrumbs::register('teams.edit', function ($breadcrumbs, $tournament) { |
|
215 | +Breadcrumbs::register('teams.edit', function($breadcrumbs, $tournament) { |
|
216 | 216 | $breadcrumbs->parent('teams.index', $tournament); |
217 | 217 | $breadcrumbs->push(trans_choice('core.team', 2), route('teams.index', $tournament->slug)); |
218 | 218 | }); |
219 | 219 | |
220 | 220 | // Home > Tournaments > MyTournament > List Fights |
221 | -Breadcrumbs::register('fights.index', function ($breadcrumbs, $tournament) { |
|
221 | +Breadcrumbs::register('fights.index', function($breadcrumbs, $tournament) { |
|
222 | 222 | if (policy($tournament)->edit(Auth::user(), $tournament)) { |
223 | 223 | $breadcrumbs->parent('tournaments.edit', $tournament); |
224 | 224 | $breadcrumbs->push(trans_choice('core.fight', 2), route('tournaments.edit', $tournament->slug)); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | }); |
231 | 231 | |
232 | 232 | // Home > Tournaments > MyTournament > List Fights |
233 | -Breadcrumbs::register('scoresheet.index', function ($breadcrumbs, $tournament) { |
|
233 | +Breadcrumbs::register('scoresheet.index', function($breadcrumbs, $tournament) { |
|
234 | 234 | if (policy($tournament)->edit(Auth::user(), $tournament)) { |
235 | 235 | $breadcrumbs->parent('tournaments.edit', $tournament); |
236 | 236 | $breadcrumbs->push(trans_choice('core.fight', 2), route('tournaments.edit', $tournament->slug)); |