@@ -71,7 +71,7 @@ |
||
71 | 71 | |
72 | 72 | // Delete previous fight for this championship |
73 | 73 | |
74 | - $arrGroupsId = $fightersGroup->map(function ($value, $key) { |
|
74 | + $arrGroupsId = $fightersGroup->map(function($value, $key) { |
|
75 | 75 | return $value->id; |
76 | 76 | })->toArray(); |
77 | 77 | Fight::destroy($arrGroupsId); |
@@ -77,11 +77,11 @@ |
||
77 | 77 | FightersGroup::generateFights($groups, $settings, $championship); |
78 | 78 | } catch (TreeGenerationException $e) { |
79 | 79 | redirect()->back() |
80 | - ->withErrors([$numFighters ."-".$e->getMessage()]); |
|
80 | + ->withErrors([$numFighters . "-" . $e->getMessage()]); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | return redirect()->back() |
84 | 84 | ->with('numFighters', $numFighters) |
85 | - ->with(['success' , "Success"]); |
|
85 | + ->with(['success', "Success"]); |
|
86 | 86 | } |
87 | 87 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('competitor_team', function (Blueprint $table) { |
|
16 | + Schema::create('competitor_team', function(Blueprint $table) { |
|
17 | 17 | $table->increments('id'); |
18 | 18 | $table->integer('team_id')->unsigned()->nullable()->index(); |
19 | 19 | $table->integer('competitor_id')->unsigned()->index(); |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | use Xoco70\KendoTournaments\TreeGen\DirectEliminationTreeGen; |
3 | 3 | |
4 | -$directEliminationTree = $championship->fightersGroups->where('round',1)->map(function ($item, $key) use ($championship) { |
|
5 | - if ($championship->category->isTeam()){ |
|
4 | +$directEliminationTree = $championship->fightersGroups->where('round', 1)->map(function($item, $key) use ($championship) { |
|
5 | + if ($championship->category->isTeam()) { |
|
6 | 6 | |
7 | 7 | $fighter1 = $item->team1 != null ? $item->team1->name : "Bye"; |
8 | 8 | $fighter2 = $item->team2 != null ? $item->team2->name : "Bye"; |
9 | - }else{ |
|
9 | + } else { |
|
10 | 10 | $fighter1 = $item->competitors->get(0) != null ? $item->competitors->get(0)->user->name : "Bye"; |
11 | 11 | $fighter2 = $item->competitors->get(1) != null ? $item->competitors->get(1)->user->name : "Bye"; |
12 | 12 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | { |
35 | 35 | if ($championship->category->isTeam) { |
36 | 36 | $fighters = $group->teams; |
37 | - if (sizeof($fighters) == 0){ |
|
37 | + if (sizeof($fighters) == 0) { |
|
38 | 38 | $fighters->push(new Team()); |
39 | 39 | $fighters->push(new Team()); |
40 | 40 | } else if (count($fighters) % 2 != 0) { |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | |
44 | 44 | } else { |
45 | 45 | $fighters = $group->competitors; |
46 | - if (sizeof($fighters) == 0){ // If |
|
46 | + if (sizeof($fighters) == 0) { // If |
|
47 | 47 | $fighters->push(new Competitor()); |
48 | 48 | $fighters->push(new Competitor()); |
49 | - }else if (count($fighters) % 2 != 0) { // If fighter is not pair, add a BYE |
|
49 | + } else if (count($fighters) % 2 != 0) { // If fighter is not pair, add a BYE |
|
50 | 50 | $fighters->push(new Competitor()); |
51 | 51 | } |
52 | 52 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('fighters_groups', function (Blueprint $table) { |
|
16 | + Schema::create('fighters_groups', function(Blueprint $table) { |
|
17 | 17 | $table->increments('id'); |
18 | 18 | $table->tinyInteger('short_id'); |
19 | 19 | $table->integer('championship_id')->unsigned()->index(); |
@@ -11,11 +11,11 @@ |
||
11 | 11 | public $timestamps = true; |
12 | 12 | |
13 | 13 | |
14 | - public function group(){ |
|
14 | + public function group() { |
|
15 | 15 | return $this->belongsTo(FightersGroup::class); |
16 | 16 | } |
17 | 17 | |
18 | - public function team(){ |
|
18 | + public function team() { |
|
19 | 19 | return $this->belongsTo(Team::class); |
20 | 20 | } |
21 | 21 | } |
22 | 22 | \ No newline at end of file |
@@ -12,11 +12,11 @@ |
||
12 | 12 | |
13 | 13 | |
14 | 14 | |
15 | - public function group(){ |
|
15 | + public function group() { |
|
16 | 16 | return $this->belongsTo(FightersGroup::class); |
17 | 17 | } |
18 | 18 | |
19 | - public function competitor(){ |
|
19 | + public function competitor() { |
|
20 | 20 | return $this->belongsTo(Competitor::class); |
21 | 21 | } |
22 | 22 | } |
23 | 23 | \ No newline at end of file |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | { |
23 | 23 | parent::boot(); |
24 | 24 | |
25 | - static::deleting(function ($championship) { |
|
25 | + static::deleting(function($championship) { |
|
26 | 26 | $championship->competitors()->delete(); |
27 | 27 | $championship->settings()->delete(); |
28 | 28 | }); |
29 | - static::restoring(function ($championship) { |
|
29 | + static::restoring(function($championship) { |
|
30 | 30 | $championship->competitors()->restore(); |
31 | 31 | $championship->settings()->restore(); |
32 | 32 | }); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | return $teamText . ' ' . $genders[$this->category->gender] . ' ' . $ageCategoryText . ' ' . $gradeText; |
190 | 190 | } |
191 | 191 | |
192 | - public function getSettings(){ |
|
192 | + public function getSettings() { |
|
193 | 193 | return $this->settings ?? new ChampionshipSettings(config('options.default_settings')); |
194 | 194 | } |
195 | 195 |