@@ -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); |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * @param Collection $fightersGroup |
| 67 | - * @param $settings |
|
| 67 | + * @param ChampionshipSettings $settings |
|
| 68 | 68 | */ |
| 69 | 69 | public static function generateFights(Collection $fightersGroup, $settings, Championship $championship = null) |
| 70 | 70 | { |
@@ -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 | } |
@@ -157,8 +157,9 @@ |
||
| 157 | 157 | |
| 158 | 158 | public function buildName() |
| 159 | 159 | { |
| 160 | - if ($this->settings != null && $this->settings->alias != null && $this->settings->alias != '') |
|
| 161 | - return $this->settings->alias; |
|
| 160 | + if ($this->settings != null && $this->settings->alias != null && $this->settings->alias != '') { |
|
| 161 | + return $this->settings->alias; |
|
| 162 | + } |
|
| 162 | 163 | |
| 163 | 164 | if ($this->hasNoCustomSettings()) { |
| 164 | 165 | return $this->category->name; |
@@ -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 | |
@@ -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 | |
@@ -6,7 +6,7 @@ |
||
| 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 | |
@@ -56,7 +56,9 @@ |
||
| 56 | 56 | $matches = array_chunk($teams, 2); |
| 57 | 57 | |
| 58 | 58 | //If there's already a match in the match array, then that means the next round is round 2, so increase the round number |
| 59 | - if (count($this->brackets)) $roundNumber++; |
|
| 59 | + if (count($this->brackets)) { |
|
| 60 | + $roundNumber++; |
|
| 61 | + } |
|
| 60 | 62 | |
| 61 | 63 | $countMatches = count($matches); |
| 62 | 64 | //Create the first full round of teams, some may be blank if waiting on the results of a previous round |
@@ -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 | |
@@ -46,7 +46,7 @@ |
||
| 46 | 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 |