@@ -7,7 +7,7 @@ |
||
7 | 7 | protected static function boot() |
8 | 8 | { |
9 | 9 | parent::boot(); |
10 | - static::deleting(function ($team) { |
|
10 | + static::deleting(function($team) { |
|
11 | 11 | $teams = Team::where('championship_id', $team->championship_id) |
12 | 12 | ->where('id', '>', $team->id)->get(); |
13 | 13 | foreach ($teams as $team) { |
@@ -32,8 +32,9 @@ |
||
32 | 32 | |
33 | 33 | public function getInvite(Tournament $tournament) |
34 | 34 | { |
35 | - if ($this->invite != 0) |
|
36 | - return Invite::findOrFail($this->invite); |
|
35 | + if ($this->invite != 0) { |
|
36 | + return Invite::findOrFail($this->invite); |
|
37 | + } |
|
37 | 38 | |
38 | 39 | return Invite::where('code', 'open') |
39 | 40 | ->where('email', Auth::user()->email) |
@@ -16,7 +16,7 @@ |
||
16 | 16 | public function index(Request $request) |
17 | 17 | { |
18 | 18 | $grades = Grade::getAllPlucked(); |
19 | - $tournament = Tournament::with(['championships.firstRoundFights' => function ($query) { |
|
19 | + $tournament = Tournament::with(['championships.firstRoundFights' => function($query) { |
|
20 | 20 | $query->with(['competitor1.user', 'competitor2.user', 'team1', 'team2']); |
21 | 21 | }])->where('slug', $request->tournament) |
22 | 22 | ->first(); |
@@ -21,7 +21,7 @@ |
||
21 | 21 | ->store(config('constants.RELATIVE_AVATAR_PATH'), 'public'); |
22 | 22 | |
23 | 23 | Image::make(storage_path('app/public/' . $file)) |
24 | - ->resize(200, 200, function ($constraint) { |
|
24 | + ->resize(200, 200, function($constraint) { |
|
25 | 25 | $constraint->aspectRatio(); |
26 | 26 | $constraint->upsize(); |
27 | 27 | }) |
@@ -26,7 +26,7 @@ |
||
26 | 26 | public function index() |
27 | 27 | { |
28 | 28 | $openTournaments = Tournament::with('owner') |
29 | - ->whereHas('owner', function ($query) { |
|
29 | + ->whereHas('owner', function($query) { |
|
30 | 30 | $query->where('country_id', Auth::user()->country_id); |
31 | 31 | }) |
32 | 32 | ->where('type', config('constants.OPEN_TOURNAMENT')) |
@@ -3,17 +3,17 @@ 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 | 19 | $breadcrumbs->push($federation->name, route('federations.edit', $federation->id)); |
@@ -24,19 +24,19 @@ discard block |
||
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 | 42 | $breadcrumbs->push($association->name, route('associations.edit', $association->id)); |
@@ -48,12 +48,12 @@ discard block |
||
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 | 59 | $breadcrumbs->push($club->name, route('clubs.edit', $club->id)); |
@@ -65,25 +65,25 @@ discard block |
||
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($tournament->name, route('tournaments.edit', $tournament->slug)); |
@@ -92,7 +92,7 @@ discard block |
||
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 | 97 | $breadcrumbs->push($tournament->name, route('tournaments.show', $tournament->slug)); |
98 | 98 | |
@@ -100,14 +100,14 @@ discard block |
||
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)); |
@@ -32,9 +32,7 @@ |
||
32 | 32 | $clean = ($anal) ? preg_replace("/[^a-zA-Z0-9]/", "", $clean) : $clean; |
33 | 33 | return ($force_lowercase) ? |
34 | 34 | (function_exists('mb_strtolower')) ? |
35 | - mb_strtolower($clean, 'UTF-8') : |
|
36 | - strtolower($clean) : |
|
37 | - $clean; |
|
35 | + mb_strtolower($clean, 'UTF-8') : strtolower($clean) : $clean; |
|
38 | 36 | } |
39 | 37 | |
40 | 38 | function isJapanese($lang) |
@@ -17,14 +17,14 @@ |
||
17 | 17 | |
18 | 18 | public static function getAll() |
19 | 19 | { |
20 | - return Cache::remember('grades', config('constants.GRADE_MINUTES'), function () { |
|
20 | + return Cache::remember('grades', config('constants.GRADE_MINUTES'), function() { |
|
21 | 21 | return static::all(); |
22 | 22 | }); |
23 | 23 | } |
24 | 24 | |
25 | 25 | public static function getAllPlucked() |
26 | 26 | { |
27 | - return Cache::remember('grades_pluck', config('constants.GRADE_MINUTES'), function () { |
|
27 | + return Cache::remember('grades_pluck', config('constants.GRADE_MINUTES'), function() { |
|
28 | 28 | return static::pluck('name', 'id'); |
29 | 29 | }); |
30 | 30 | } |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | |
38 | 38 | public static function sendInvites($reader, $tournament) |
39 | 39 | { |
40 | - $reader->each(function ($sheet) use ($tournament) { |
|
40 | + $reader->each(function($sheet) use ($tournament) { |
|
41 | 41 | // Loop through all rows of spreadsheet |
42 | - $sheet->each(function ($row) use ($tournament) { |
|
42 | + $sheet->each(function($row) use ($tournament) { |
|
43 | 43 | // Check email |
44 | 44 | $invite = new Invite(); |
45 | 45 | $code = $invite->generateTournamentInvite($row, $tournament); |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function checkBadEmailsInExcel($reader, $tournament) |
120 | 120 | { |
121 | - $reader->each(function ($sheet) use ($tournament) { |
|
121 | + $reader->each(function($sheet) use ($tournament) { |
|
122 | 122 | // Loop through all rows |
123 | - $sheet->each(function ($row) use ($tournament) { |
|
123 | + $sheet->each(function($row) use ($tournament) { |
|
124 | 124 | // Check email |
125 | 125 | if (!filter_var($row, FILTER_VALIDATE_EMAIL)) { |
126 | 126 | $this->emailBadFormat = true; |
@@ -67,8 +67,9 @@ |
||
67 | 67 | $invite->expiration = $tournament->registerDateLimit; |
68 | 68 | $invite->active = true; |
69 | 69 | |
70 | - if ($invite->save()) |
|
71 | - return $token; |
|
70 | + if ($invite->save()) { |
|
71 | + return $token; |
|
72 | + } |
|
72 | 73 | |
73 | 74 | return null; |
74 | 75 | } |