@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | public static function boot() |
70 | 70 | { |
71 | 71 | parent::boot(); |
72 | - static::creating(function ($user) { |
|
72 | + static::creating(function($user) { |
|
73 | 73 | $softDeletedUser = User::onlyTrashed()->where('email', '=', $user->email)->first(); |
74 | 74 | if ($softDeletedUser != null) { |
75 | 75 | $softDeletedUser->restore(); |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | // If a User is deleted, you must delete: |
86 | 86 | // His tournaments, his competitors |
87 | 87 | |
88 | - static::deleting(function ($user) { |
|
88 | + static::deleting(function($user) { |
|
89 | 89 | $user->tournaments->each->delete(); |
90 | 90 | $user->competitors->each->delete(); |
91 | 91 | |
92 | 92 | }); |
93 | - static::restoring(function ($user) { |
|
93 | + static::restoring(function($user) { |
|
94 | 94 | $user->competitors()->withTrashed()->get()->each->restore(); |
95 | 95 | $user->tournaments()->withTrashed()->get()->each->restore(); |
96 | 96 | }); |
@@ -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) |