@@ -152,6 +152,9 @@ |
||
152 | 152 | // } |
153 | 153 | // } |
154 | 154 | |
155 | + /** |
|
156 | + * @param Collection $rounds |
|
157 | + */ |
|
155 | 158 | public static function saveRoundRobinFights(Championship $championship, $rounds) |
156 | 159 | { |
157 | 160 |
@@ -4,9 +4,7 @@ |
||
4 | 4 | namespace Xoco70\KendoTournaments\Models; |
5 | 5 | |
6 | 6 | |
7 | -use App\User; |
|
8 | 7 | use Illuminate\Database\Eloquent\Model; |
9 | -use Illuminate\Support\Collection; |
|
10 | 8 | |
11 | 9 | class Fight extends Model |
12 | 10 | { |
@@ -160,7 +160,7 @@ |
||
160 | 160 | |
161 | 161 | $fighters = self::getActorsToFights($championship, $round2); |
162 | 162 | |
163 | - $away = $fighters->splice(sizeof($fighters) / 2); // 2 |
|
163 | + $away = $fighters->splice(sizeof($fighters) / 2); // 2 |
|
164 | 164 | |
165 | 165 | $home = $fighters; // 1 |
166 | 166 |
@@ -62,7 +62,7 @@ |
||
62 | 62 | |
63 | 63 | /** |
64 | 64 | * @param Collection $rounds |
65 | - * @param $settings |
|
65 | + * @param ChampionshipSettings $settings |
|
66 | 66 | * @param Championship $championship |
67 | 67 | */ |
68 | 68 | public static function generateFights(Collection $rounds, $settings, Championship $championship = null) |
@@ -70,7 +70,7 @@ |
||
70 | 70 | |
71 | 71 | // Delete previous fight for this championship |
72 | 72 | |
73 | - $arrRoundsId = $rounds->map(function ($value, $key) { |
|
73 | + $arrRoundsId = $rounds->map(function($value, $key) { |
|
74 | 74 | return $value->id; |
75 | 75 | })->toArray(); |
76 | 76 | Fight::destroy($arrRoundsId); |
@@ -19,6 +19,9 @@ discard block |
||
19 | 19 | public $championship, $settings; |
20 | 20 | |
21 | 21 | |
22 | + /** |
|
23 | + * @param \Xoco70\KendoTournaments\Models\ChampionshipSettings $settings |
|
24 | + */ |
|
22 | 25 | public function __construct(Championship $championship, $groupBy, $settings) |
23 | 26 | { |
24 | 27 | $this->championship = $championship; |
@@ -242,7 +245,7 @@ discard block |
||
242 | 245 | |
243 | 246 | /** |
244 | 247 | * @param $fighterGroups |
245 | - * @param $max |
|
248 | + * @param integer $max |
|
246 | 249 | * @return Collection |
247 | 250 | */ |
248 | 251 | private function repart($fighterGroups, $max) |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $round->teams()->sync($fighters); |
106 | 106 | } else { |
107 | 107 | $round->competitors()->detach(); |
108 | - foreach ($fighters as $fighter){ |
|
108 | + foreach ($fighters as $fighter) { |
|
109 | 109 | $round->competitors()->attach($fighter); |
110 | 110 | } |
111 | 111 | // $round->competitors()->sync($fighters); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | private function getTreeSize($fighterCount, $groupSize) |
209 | 209 | { |
210 | 210 | $square = collect([1, 2, 4, 8, 16, 32, 64]); |
211 | - $squareMultiplied = $square->map(function ($item, $key) use ($groupSize) { |
|
211 | + $squareMultiplied = $square->map(function($item, $key) use ($groupSize) { |
|
212 | 212 | return $item * $groupSize; |
213 | 213 | }); |
214 | 214 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('round_competitor', function (Blueprint $table) { |
|
16 | + Schema::create('round_competitor', function(Blueprint $table) { |
|
17 | 17 | $table->increments('id'); |
18 | 18 | $table->integer('competitor_id')->unsigned()->nullable()->index(); |
19 | 19 | $table->integer('round_id')->unsigned()->index(); // A checar |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('round_team', function (Blueprint $table) { |
|
16 | + Schema::create('round_team', function(Blueprint $table) { |
|
17 | 17 | $table->increments('id'); |
18 | 18 | $table->integer('team_id')->unsigned()->nullable()->index(); |
19 | 19 | $table->integer('round_id')->unsigned()->index(); // A checar |
@@ -31,7 +31,7 @@ |
||
31 | 31 | |
32 | 32 | public function rounds() |
33 | 33 | { |
34 | - return $this->belongsToMany(Round::class,'round_team'); |
|
34 | + return $this->belongsToMany(Round::class, 'round_team'); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | } |
38 | 38 | \ No newline at end of file |
@@ -76,7 +76,7 @@ |
||
76 | 76 | |
77 | 77 | public function rounds() |
78 | 78 | { |
79 | - return $this->belongsToMany(Round::class,'round_competitor'); |
|
79 | + return $this->belongsToMany(Round::class, 'round_competitor'); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | } |
@@ -47,7 +47,7 @@ |
||
47 | 47 | 'championshipSettings' |
48 | 48 | )->first(); |
49 | 49 | |
50 | - $championship = Championship::with('teams','users','category','settings')->find($championship->id); |
|
50 | + $championship = Championship::with('teams', 'users', 'category', 'settings')->find($championship->id); |
|
51 | 51 | |
52 | 52 | $settings = ChampionshipSettings::createOrUpdate($request, $championship); |
53 | 53 |