@@ -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')) { |
@@ -301,7 +301,7 @@ |
||
301 | 301 | function getMaxFightersByEntity($userGroups): int |
302 | 302 | { |
303 | 303 | return $userGroups |
304 | - ->sortByDesc(function ($group) { |
|
304 | + ->sortByDesc(function($group) { |
|
305 | 305 | return $group->count(); |
306 | 306 | }) |
307 | 307 | ->first() |
@@ -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 | /** |
@@ -28,7 +28,7 @@ |
||
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); |
@@ -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); |
@@ -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/seeds' => $this->app->databasePath().'/seeds'], '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/seeds' => $this->app->databasePath() . '/seeds'], '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 | /** |
@@ -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(); |