@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | public function up() |
15 | 15 | { |
16 | 16 | if (!Schema::hasTable('users')) { |
17 | - Schema::create('users', function (Blueprint $table) { |
|
17 | + Schema::create('users', function(Blueprint $table) { |
|
18 | 18 | $table->increments('id'); |
19 | 19 | $table->string('name'); |
20 | 20 | $table->string('firstname')->default('firstname'); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $table->timestamps(); |
25 | 25 | }); |
26 | 26 | } else { |
27 | - Schema::table('users', function (Blueprint $table) { |
|
27 | + Schema::table('users', function(Blueprint $table) { |
|
28 | 28 | if (!Schema::hasColumn('users', 'name')) { |
29 | 29 | $table->string('name')->default('name'); |
30 | 30 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $table->string('lastname')->default('lastname'); |
36 | 36 | } |
37 | 37 | if (!Schema::hasColumn('users', 'email')) { |
38 | - $table->string('email')->default('user_'.rand(100000, 999999).'@kendozone.com')->unique(); |
|
38 | + $table->string('email')->default('user_' . rand(100000, 999999) . '@kendozone.com')->unique(); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | if (!Schema::hasColumn('users', 'password')) { |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | protected function getTreeSize($fighterCount, $groupSize) |
92 | 92 | { |
93 | 93 | $squareMultiplied = collect([1, 2, 4, 8, 16, 32, 64]) |
94 | - ->map(function ($item) use ($groupSize) { |
|
94 | + ->map(function($item) use ($groupSize) { |
|
95 | 95 | return $item * $groupSize; |
96 | 96 | }); // [4, 8, 16, 32, 64,...] |
97 | 97 | |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | protected function getFightersByArea() |
198 | 198 | { |
199 | 199 | $areas = $this->settings->fightingAreas; |
200 | - $fighters = $this->getFighters(); // Get Competitor or Team Objects |
|
201 | - $fighterByEntity = $this->getFightersByEntity($fighters); // Chunk it by entities (Fede, Assoc, Club,...) |
|
202 | - $fightersWithBye = $this->adjustFightersGroupWithByes($fighters, $fighterByEntity); // Fill with Byes |
|
203 | - return $fightersWithBye->chunk(count($fightersWithBye) / $areas); // Chunk user by areas |
|
200 | + $fighters = $this->getFighters(); // Get Competitor or Team Objects |
|
201 | + $fighterByEntity = $this->getFightersByEntity($fighters); // Chunk it by entities (Fede, Assoc, Club,...) |
|
202 | + $fightersWithBye = $this->adjustFightersGroupWithByes($fighters, $fighterByEntity); // Fill with Byes |
|
203 | + return $fightersWithBye->chunk(count($fightersWithBye) / $areas); // Chunk user by areas |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | |
4 | -$factory->define(config('laravel-tournaments.user.model'), function (Faker\Generator $faker) { |
|
4 | +$factory->define(config('laravel-tournaments.user.model'), function(Faker\Generator $faker) { |
|
5 | 5 | return [ |
6 | 6 | 'name' => $faker->name, |
7 | 7 | 'email' => $faker->unique()->safeEmail, |
@@ -3,7 +3,7 @@ |
||
3 | 3 | use Xoco70\LaravelTournaments\Models\Championship; |
4 | 4 | use Xoco70\LaravelTournaments\Models\Competitor; |
5 | 5 | |
6 | -$factory->define(Competitor::class, function (Faker\Generator $faker) { |
|
6 | +$factory->define(Competitor::class, function(Faker\Generator $faker) { |
|
7 | 7 | $tcs = Championship::all()->pluck('id')->toArray(); |
8 | 8 | $users = config('laravel-tournaments.user.model')::all()->pluck('id')->toArray(); |
9 | 9 | $championshipId = $faker->randomElement($tcs); |
@@ -9,7 +9,7 @@ |
||
9 | 9 | { |
10 | 10 | public function up() |
11 | 11 | { |
12 | - Schema::create('tournament', function (Blueprint $table) { |
|
12 | + Schema::create('tournament', function(Blueprint $table) { |
|
13 | 13 | $table->increments('id'); |
14 | 14 | //TODO Added ->nullable() to solve FK issue with Sqlite :( |
15 | 15 | $table->bigInteger('user_id')->unsigned()->nullable()->index(); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $bye = $this->createByeFighter(); |
227 | 227 | $groupSize = $this->firstRoundGroupSize(); |
228 | 228 | $frequency = $groupSize != 0 |
229 | - ? (int) floor(count($fighters) / $groupSize / $groupSize) |
|
229 | + ? (int)floor(count($fighters) / $groupSize / $groupSize) |
|
230 | 230 | : -1; |
231 | 231 | if ($frequency < $groupSize) { |
232 | 232 | $frequency = $groupSize; |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | private function getMaxFightersByEntity($userGroups): int |
306 | 306 | { |
307 | 307 | return $userGroups |
308 | - ->sortByDesc(function ($group) { |
|
308 | + ->sortByDesc(function($group) { |
|
309 | 309 | return $group->count(); |
310 | 310 | }) |
311 | 311 | ->first() |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | public function build() |
30 | 30 | { |
31 | - $fighters = $this->groupsByRound->first()->map(function ($item) { |
|
31 | + $fighters = $this->groupsByRound->first()->map(function($item) { |
|
32 | 32 | $fighters = $item->getFightersWithBye(); |
33 | 33 | $fighter1 = $fighters->get(0); |
34 | 34 | $fighter2 = $fighters->get(1); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | //The minus 3 is to ignore the final, semi final and quarter final rounds |
138 | 138 | |
139 | 139 | for ($i = 0; $i < $noRounds - 3; $i++) { |
140 | - $tempRounds[] = 'Last '.$noTeamsInFirstRound; |
|
140 | + $tempRounds[] = 'Last ' . $noTeamsInFirstRound; |
|
141 | 141 | $noTeamsInFirstRound /= 2; |
142 | 142 | } |
143 | 143 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | foreach ($roundTitles as $key => $roundTitle) { |
160 | 160 | $left = $key * ($this->matchWrapperWidth + $this->roundSpacing - 1); |
161 | 161 | |
162 | - echo '<div class="round-title" style="left: '.$left.'px;">'.$roundTitle.'</div>'; |
|
162 | + echo '<div class="round-title" style="left: ' . $left . 'px;">' . $roundTitle . '</div>'; |
|
163 | 163 | } |
164 | 164 | echo '</div>'; |
165 | 165 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | public function getPlayerList($selected) |
173 | 173 | { |
174 | 174 | $html = '<select> |
175 | - <option'.($selected == '' ? ' selected' : '').'></option>'; |
|
175 | + <option'.($selected == '' ? ' selected' : '') . '></option>'; |
|
176 | 176 | |
177 | 177 | foreach ($this->championship->fighters as $fighter) { |
178 | 178 | $html = $this->addOptionToSelect($selected, $fighter, $html); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | { |
233 | 233 | if ($fighter != null) { |
234 | 234 | $select = $selected != null && $selected->id == $fighter->id ? ' selected' : ''; |
235 | - $html .= '<option'.$select |
|
235 | + $html .= '<option' . $select |
|
236 | 236 | .' value=' |
237 | 237 | .($fighter->id ?? '') |
238 | 238 | .'>' |
@@ -16,16 +16,16 @@ |
||
16 | 16 | */ |
17 | 17 | public function boot() |
18 | 18 | { |
19 | - $viewPath = __DIR__.'/../resources/views'; |
|
19 | + $viewPath = __DIR__ . '/../resources/views'; |
|
20 | 20 | $this->loadViewsFrom($viewPath, 'laravel-tournaments'); |
21 | 21 | |
22 | - $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
|
23 | - $this->loadTranslationsFrom(__DIR__.'/../translations', 'laravel-tournaments'); |
|
22 | + $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); |
|
23 | + $this->loadTranslationsFrom(__DIR__ . '/../translations', 'laravel-tournaments'); |
|
24 | 24 | |
25 | - $this->publishes([__DIR__ . '/../database/seeders' => $this->app->databasePath().'/seeders'], 'laravel-tournaments'); |
|
26 | - $this->publishes([__DIR__.'/../database/factories' => $this->app->databasePath().'/factories'], 'laravel-tournaments'); |
|
27 | - $this->publishes([__DIR__.'/../resources/assets' => public_path('vendor/laravel-tournaments')], 'laravel-tournaments'); |
|
28 | - $this->publishes([__DIR__.'/../config/laravel-tournaments.php' => config_path('laravel-tournaments.php')], 'laravel-tournaments'); |
|
25 | + $this->publishes([__DIR__ . '/../database/seeders' => $this->app->databasePath() . '/seeders'], 'laravel-tournaments'); |
|
26 | + $this->publishes([__DIR__ . '/../database/factories' => $this->app->databasePath() . '/factories'], 'laravel-tournaments'); |
|
27 | + $this->publishes([__DIR__ . '/../resources/assets' => public_path('vendor/laravel-tournaments')], 'laravel-tournaments'); |
|
28 | + $this->publishes([__DIR__ . '/../config/laravel-tournaments.php' => config_path('laravel-tournaments.php')], 'laravel-tournaments'); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |