@@ -8,70 +8,70 @@ |
||
| 8 | 8 | {
|
| 9 | 9 | |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * @group OrmModels |
|
| 13 | - * @group PlayerOrm |
|
| 14 | - */ |
|
| 15 | - public function testPlayerOrmGetSet() |
|
| 16 | - {
|
|
| 17 | - $rndFiller = new \App\Lib\DsManager\Helpers\RandomFiller(); |
|
| 18 | - $playerM = $rndFiller->getPlayer(); |
|
| 19 | - $arrayPl = $playerM->toArray(); |
|
| 20 | - $playerO = \App\Lib\DsManager\Models\Orm\Player::create($arrayPl); |
|
| 21 | - $this->assertNotEmpty($playerO); |
|
| 11 | + /** |
|
| 12 | + * @group OrmModels |
|
| 13 | + * @group PlayerOrm |
|
| 14 | + */ |
|
| 15 | + public function testPlayerOrmGetSet() |
|
| 16 | + {
|
|
| 17 | + $rndFiller = new \App\Lib\DsManager\Helpers\RandomFiller(); |
|
| 18 | + $playerM = $rndFiller->getPlayer(); |
|
| 19 | + $arrayPl = $playerM->toArray(); |
|
| 20 | + $playerO = \App\Lib\DsManager\Models\Orm\Player::create($arrayPl); |
|
| 21 | + $this->assertNotEmpty($playerO); |
|
| 22 | 22 | |
| 23 | - $newPlayer = \App\Lib\DsManager\Models\Player::fromArray($playerO->toArray()); |
|
| 24 | - $this->assertNotEmpty($newPlayer); |
|
| 25 | - } |
|
| 23 | + $newPlayer = \App\Lib\DsManager\Models\Player::fromArray($playerO->toArray()); |
|
| 24 | + $this->assertNotEmpty($newPlayer); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @group OrmModels |
|
| 29 | - * @group CoachOrm |
|
| 30 | - */ |
|
| 31 | - public function testCoachOrmGetSet() |
|
| 32 | - {
|
|
| 33 | - $rndFiller = new \App\Lib\DsManager\Helpers\RandomFiller(); |
|
| 34 | - $coach = $rndFiller->getCoach(); |
|
| 35 | - $arrayPl = $coach->toArray(); |
|
| 36 | - $coachO = \App\Lib\DsManager\Models\Orm\Coach::create($arrayPl); |
|
| 37 | - $this->assertNotEmpty($coachO); |
|
| 27 | + /** |
|
| 28 | + * @group OrmModels |
|
| 29 | + * @group CoachOrm |
|
| 30 | + */ |
|
| 31 | + public function testCoachOrmGetSet() |
|
| 32 | + {
|
|
| 33 | + $rndFiller = new \App\Lib\DsManager\Helpers\RandomFiller(); |
|
| 34 | + $coach = $rndFiller->getCoach(); |
|
| 35 | + $arrayPl = $coach->toArray(); |
|
| 36 | + $coachO = \App\Lib\DsManager\Models\Orm\Coach::create($arrayPl); |
|
| 37 | + $this->assertNotEmpty($coachO); |
|
| 38 | 38 | |
| 39 | - $newCoach = \App\Lib\DsManager\Models\Coach::fromArray($coachO->toArray()); |
|
| 40 | - $this->assertNotEmpty($newCoach); |
|
| 41 | - } |
|
| 39 | + $newCoach = \App\Lib\DsManager\Models\Coach::fromArray($coachO->toArray()); |
|
| 40 | + $this->assertNotEmpty($newCoach); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * @group OrmModels |
|
| 45 | - * @group TeamOrm |
|
| 46 | - */ |
|
| 47 | - public function testTeamOrm() |
|
| 48 | - {
|
|
| 49 | - $rndFiller = new \App\Lib\DsManager\Helpers\RandomFiller(); |
|
| 50 | - $team = $rndFiller->getTeam($rndFiller->getLocale()); |
|
| 51 | - $teamArray = $team->toArray(); |
|
| 52 | - $this->assertNotEmpty($team); |
|
| 53 | - $teamO = \App\Lib\DsManager\Models\Orm\Team::create($teamArray); |
|
| 54 | - $this->assertNotEmpty($teamArray); |
|
| 55 | - $this->assertNotEmpty($teamArray['roster']); |
|
| 56 | - foreach ($teamArray['roster'] as $player) {
|
|
| 57 | - $player['team_id'] = $teamO->id; |
|
| 58 | - $playerO = \App\Lib\DsManager\Models\Orm\Player::create($player); |
|
| 59 | - $this->assertNotEmpty($playerO); |
|
| 60 | - } |
|
| 61 | - $teamArray['coach']['team_id'] = $teamO->id; |
|
| 62 | - $coachO = \App\Lib\DsManager\Models\Orm\Coach::create($teamArray['coach']); |
|
| 63 | - $this->assertNotEmpty($coachO); |
|
| 43 | + /** |
|
| 44 | + * @group OrmModels |
|
| 45 | + * @group TeamOrm |
|
| 46 | + */ |
|
| 47 | + public function testTeamOrm() |
|
| 48 | + {
|
|
| 49 | + $rndFiller = new \App\Lib\DsManager\Helpers\RandomFiller(); |
|
| 50 | + $team = $rndFiller->getTeam($rndFiller->getLocale()); |
|
| 51 | + $teamArray = $team->toArray(); |
|
| 52 | + $this->assertNotEmpty($team); |
|
| 53 | + $teamO = \App\Lib\DsManager\Models\Orm\Team::create($teamArray); |
|
| 54 | + $this->assertNotEmpty($teamArray); |
|
| 55 | + $this->assertNotEmpty($teamArray['roster']); |
|
| 56 | + foreach ($teamArray['roster'] as $player) {
|
|
| 57 | + $player['team_id'] = $teamO->id; |
|
| 58 | + $playerO = \App\Lib\DsManager\Models\Orm\Player::create($player); |
|
| 59 | + $this->assertNotEmpty($playerO); |
|
| 60 | + } |
|
| 61 | + $teamArray['coach']['team_id'] = $teamO->id; |
|
| 62 | + $coachO = \App\Lib\DsManager\Models\Orm\Coach::create($teamArray['coach']); |
|
| 63 | + $this->assertNotEmpty($coachO); |
|
| 64 | 64 | |
| 65 | - $this->assertNotEmpty( |
|
| 66 | - \App\Lib\DsManager\Models\Orm\Team::with( |
|
| 67 | - 'roster' |
|
| 68 | - )->with( |
|
| 69 | - 'coach' |
|
| 70 | - )->where( |
|
| 71 | - [ |
|
| 72 | - 'id' => $teamO->id |
|
| 73 | - ] |
|
| 74 | - )->get()->toArray() |
|
| 75 | - ); |
|
| 76 | - } |
|
| 65 | + $this->assertNotEmpty( |
|
| 66 | + \App\Lib\DsManager\Models\Orm\Team::with( |
|
| 67 | + 'roster' |
|
| 68 | + )->with( |
|
| 69 | + 'coach' |
|
| 70 | + )->where( |
|
| 71 | + [ |
|
| 72 | + 'id' => $teamO->id |
|
| 73 | + ] |
|
| 74 | + )->get()->toArray() |
|
| 75 | + ); |
|
| 76 | + } |
|
| 77 | 77 | } |
@@ -8,76 +8,76 @@ |
||
| 8 | 8 | {
|
| 9 | 9 | |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * @group Modules |
|
| 13 | - * @group config |
|
| 14 | - */ |
|
| 15 | - public function testAllTheModulesGot11Players() |
|
| 16 | - {
|
|
| 17 | - $modules = \App\Lib\Helpers\Config::get('modules.modules');
|
|
| 18 | - $this->assertNotEmpty($modules); |
|
| 19 | - foreach ($modules as $key => $module) {
|
|
| 20 | - $this->assertNotEmpty($module["roles"]); |
|
| 21 | - $count = 0; |
|
| 22 | - foreach ($module["roles"] as $roleNum) {
|
|
| 23 | - $count += $roleNum; |
|
| 24 | - } |
|
| 25 | - $this->assertTrue(11 === $count, "Not correct Players for $key"); |
|
| 26 | - } |
|
| 27 | - } |
|
| 11 | + /** |
|
| 12 | + * @group Modules |
|
| 13 | + * @group config |
|
| 14 | + */ |
|
| 15 | + public function testAllTheModulesGot11Players() |
|
| 16 | + {
|
|
| 17 | + $modules = \App\Lib\Helpers\Config::get('modules.modules');
|
|
| 18 | + $this->assertNotEmpty($modules); |
|
| 19 | + foreach ($modules as $key => $module) {
|
|
| 20 | + $this->assertNotEmpty($module["roles"]); |
|
| 21 | + $count = 0; |
|
| 22 | + foreach ($module["roles"] as $roleNum) {
|
|
| 23 | + $count += $roleNum; |
|
| 24 | + } |
|
| 25 | + $this->assertTrue(11 === $count, "Not correct Players for $key"); |
|
| 26 | + } |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * @group Roles |
|
| 31 | - * @group config |
|
| 32 | - */ |
|
| 33 | - public function testCorrectDisplayModuleDescriptionRole() |
|
| 34 | - {
|
|
| 35 | - $modules = \App\Lib\Helpers\Config::get('modules.modules');
|
|
| 36 | - $this->assertNotEmpty($modules); |
|
| 37 | - $roles = \App\Lib\Helpers\Config::get('modules.roles');
|
|
| 38 | - $rolesKeys = array_keys($roles); |
|
| 29 | + /** |
|
| 30 | + * @group Roles |
|
| 31 | + * @group config |
|
| 32 | + */ |
|
| 33 | + public function testCorrectDisplayModuleDescriptionRole() |
|
| 34 | + {
|
|
| 35 | + $modules = \App\Lib\Helpers\Config::get('modules.modules');
|
|
| 36 | + $this->assertNotEmpty($modules); |
|
| 37 | + $roles = \App\Lib\Helpers\Config::get('modules.roles');
|
|
| 38 | + $rolesKeys = array_keys($roles); |
|
| 39 | 39 | |
| 40 | - foreach ($modules as $key => $module) {
|
|
| 41 | - $this->assertNotEmpty($module["roles"]); |
|
| 42 | - foreach ($module["roles"] as $index => $playNum) {
|
|
| 43 | - if ($playNum != 0) {
|
|
| 44 | - $this->assertGreaterThan(0, $playNum); |
|
| 45 | - $this->assertNotNull($roles[$rolesKeys[$index]]["description"]); |
|
| 46 | - } |
|
| 47 | - } |
|
| 48 | - } |
|
| 49 | - } |
|
| 40 | + foreach ($modules as $key => $module) {
|
|
| 41 | + $this->assertNotEmpty($module["roles"]); |
|
| 42 | + foreach ($module["roles"] as $index => $playNum) {
|
|
| 43 | + if ($playNum != 0) {
|
|
| 44 | + $this->assertGreaterThan(0, $playNum); |
|
| 45 | + $this->assertNotNull($roles[$rolesKeys[$index]]["description"]); |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | + } |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @group rand |
|
| 53 | - * |
|
| 54 | - */ |
|
| 55 | - public function testRandomizer() |
|
| 56 | - {
|
|
| 57 | - $yes = 0; |
|
| 58 | - $no = 0; |
|
| 59 | - for ($i = 1; $i <= 100; $i++) {
|
|
| 60 | - if (\App\Lib\DsManager\Helpers\Randomizer::boolOnPercentage(20)) {
|
|
| 61 | - $yes++; |
|
| 62 | - } else {
|
|
| 63 | - $no++; |
|
| 64 | - } |
|
| 65 | - } |
|
| 66 | - $this->assertNotEmpty($yes); |
|
| 67 | - $this->assertNotEmpty($no); |
|
| 68 | - $this->assertGreaterThan($yes, $no); |
|
| 69 | - } |
|
| 51 | + /** |
|
| 52 | + * @group rand |
|
| 53 | + * |
|
| 54 | + */ |
|
| 55 | + public function testRandomizer() |
|
| 56 | + {
|
|
| 57 | + $yes = 0; |
|
| 58 | + $no = 0; |
|
| 59 | + for ($i = 1; $i <= 100; $i++) {
|
|
| 60 | + if (\App\Lib\DsManager\Helpers\Randomizer::boolOnPercentage(20)) {
|
|
| 61 | + $yes++; |
|
| 62 | + } else {
|
|
| 63 | + $no++; |
|
| 64 | + } |
|
| 65 | + } |
|
| 66 | + $this->assertNotEmpty($yes); |
|
| 67 | + $this->assertNotEmpty($no); |
|
| 68 | + $this->assertGreaterThan($yes, $no); |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * @group randFiller |
|
| 73 | - * |
|
| 74 | - */ |
|
| 75 | - public function testRandomFiller() |
|
| 76 | - {
|
|
| 77 | - $rndF = new \App\Lib\DsManager\Helpers\RandomFiller(); |
|
| 78 | - for ($i = 1; $i <= 10; $i++) {
|
|
| 79 | - $this->assertNotEmpty($rndF->getLocale()); |
|
| 80 | - } |
|
| 81 | - } |
|
| 71 | + /** |
|
| 72 | + * @group randFiller |
|
| 73 | + * |
|
| 74 | + */ |
|
| 75 | + public function testRandomFiller() |
|
| 76 | + {
|
|
| 77 | + $rndF = new \App\Lib\DsManager\Helpers\RandomFiller(); |
|
| 78 | + for ($i = 1; $i <= 10; $i++) {
|
|
| 79 | + $this->assertNotEmpty($rndF->getLocale()); |
|
| 80 | + } |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | 83 | } |
@@ -3,20 +3,20 @@ |
||
| 3 | 3 | |
| 4 | 4 | class ATeamsSeeder |
| 5 | 5 | { |
| 6 | - function run() |
|
| 7 | - { |
|
| 8 | - $teamNumber = 10; |
|
| 9 | - $rndFiller = new \App\Lib\DsManager\Helpers\RandomFiller(); |
|
| 10 | - for ($i = 1; $i <= $teamNumber; $i++) { |
|
| 11 | - $team = $rndFiller->getTeam($rndFiller->getLocale()); |
|
| 12 | - $teamArray = $team->toArray(); |
|
| 13 | - $teamO = \App\Lib\DsManager\Models\Orm\Team::create($teamArray); |
|
| 14 | - foreach ($teamArray['roster'] as $player) { |
|
| 15 | - $player['team_id'] = $teamO->id; |
|
| 16 | - \App\Lib\DsManager\Models\Orm\Player::create($player); |
|
| 17 | - } |
|
| 18 | - $teamArray['coach']['team_id'] = $teamO->id; |
|
| 19 | - \App\Lib\DsManager\Models\Orm\Coach::create($teamArray['coach']); |
|
| 20 | - } |
|
| 21 | - } |
|
| 6 | + function run() |
|
| 7 | + { |
|
| 8 | + $teamNumber = 10; |
|
| 9 | + $rndFiller = new \App\Lib\DsManager\Helpers\RandomFiller(); |
|
| 10 | + for ($i = 1; $i <= $teamNumber; $i++) { |
|
| 11 | + $team = $rndFiller->getTeam($rndFiller->getLocale()); |
|
| 12 | + $teamArray = $team->toArray(); |
|
| 13 | + $teamO = \App\Lib\DsManager\Models\Orm\Team::create($teamArray); |
|
| 14 | + foreach ($teamArray['roster'] as $player) { |
|
| 15 | + $player['team_id'] = $teamO->id; |
|
| 16 | + \App\Lib\DsManager\Models\Orm\Player::create($player); |
|
| 17 | + } |
|
| 18 | + $teamArray['coach']['team_id'] = $teamO->id; |
|
| 19 | + \App\Lib\DsManager\Models\Orm\Coach::create($teamArray['coach']); |
|
| 20 | + } |
|
| 21 | + } |
|
| 22 | 22 | } |
| 23 | 23 | \ No newline at end of file |
@@ -5,19 +5,19 @@ |
||
| 5 | 5 | |
| 6 | 6 | class CreateTeamTable |
| 7 | 7 | {
|
| 8 | - /** |
|
| 9 | - * Run the migrations. |
|
| 10 | - * |
|
| 11 | - * @return void |
|
| 12 | - */ |
|
| 13 | - public function run() |
|
| 14 | - {
|
|
| 15 | - Capsule::schema()->dropIfExists('teams');
|
|
| 16 | - Capsule::schema()->create('teams', function (Blueprint $table) {
|
|
| 17 | - $table->increments('id');
|
|
| 18 | - $table->string('name');
|
|
| 19 | - $table->string('nationality',2);
|
|
| 20 | - $table->timestamps(); |
|
| 21 | - }); |
|
| 22 | - } |
|
| 8 | + /** |
|
| 9 | + * Run the migrations. |
|
| 10 | + * |
|
| 11 | + * @return void |
|
| 12 | + */ |
|
| 13 | + public function run() |
|
| 14 | + {
|
|
| 15 | + Capsule::schema()->dropIfExists('teams');
|
|
| 16 | + Capsule::schema()->create('teams', function (Blueprint $table) {
|
|
| 17 | + $table->increments('id');
|
|
| 18 | + $table->string('name');
|
|
| 19 | + $table->string('nationality',2);
|
|
| 20 | + $table->timestamps(); |
|
| 21 | + }); |
|
| 22 | + } |
|
| 23 | 23 | } |
@@ -5,35 +5,35 @@ |
||
| 5 | 5 | |
| 6 | 6 | class CreateCoachesTable |
| 7 | 7 | {
|
| 8 | - /** |
|
| 9 | - * Run the migrations. |
|
| 10 | - * |
|
| 11 | - * @return void |
|
| 12 | - */ |
|
| 13 | - public function run() |
|
| 14 | - {
|
|
| 15 | - Capsule::schema()->dropIfExists('coaches');
|
|
| 16 | - Capsule::schema()->create('coaches', function (Blueprint $table) {
|
|
| 17 | - $table->increments('id');
|
|
| 18 | - $table->string('name');
|
|
| 19 | - $table->string('surname');
|
|
| 20 | - $table->tinyInteger('age');
|
|
| 21 | - $table->string('nationality',2);
|
|
| 22 | - $table->float('skillAvg');
|
|
| 23 | - $table->float('wageReq');
|
|
| 24 | - $table->string('favouriteModule',10);
|
|
| 25 | - $table->integer('team_id')->nullable();
|
|
| 26 | - $table->timestamps(); |
|
| 27 | - }); |
|
| 28 | - } |
|
| 8 | + /** |
|
| 9 | + * Run the migrations. |
|
| 10 | + * |
|
| 11 | + * @return void |
|
| 12 | + */ |
|
| 13 | + public function run() |
|
| 14 | + {
|
|
| 15 | + Capsule::schema()->dropIfExists('coaches');
|
|
| 16 | + Capsule::schema()->create('coaches', function (Blueprint $table) {
|
|
| 17 | + $table->increments('id');
|
|
| 18 | + $table->string('name');
|
|
| 19 | + $table->string('surname');
|
|
| 20 | + $table->tinyInteger('age');
|
|
| 21 | + $table->string('nationality',2);
|
|
| 22 | + $table->float('skillAvg');
|
|
| 23 | + $table->float('wageReq');
|
|
| 24 | + $table->string('favouriteModule',10);
|
|
| 25 | + $table->integer('team_id')->nullable();
|
|
| 26 | + $table->timestamps(); |
|
| 27 | + }); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Reverse the migrations. |
|
| 32 | - * |
|
| 33 | - * @return void |
|
| 34 | - */ |
|
| 35 | - public function down() |
|
| 36 | - {
|
|
| 37 | - Schema::drop('coaches');
|
|
| 38 | - } |
|
| 30 | + /** |
|
| 31 | + * Reverse the migrations. |
|
| 32 | + * |
|
| 33 | + * @return void |
|
| 34 | + */ |
|
| 35 | + public function down() |
|
| 36 | + {
|
|
| 37 | + Schema::drop('coaches');
|
|
| 38 | + } |
|
| 39 | 39 | } |
@@ -5,26 +5,26 @@ |
||
| 5 | 5 | |
| 6 | 6 | class CreatePlayersTable |
| 7 | 7 | {
|
| 8 | - /** |
|
| 9 | - * Run the migrations. |
|
| 10 | - * |
|
| 11 | - * @return void |
|
| 12 | - */ |
|
| 13 | - public function run() |
|
| 14 | - {
|
|
| 15 | - Capsule::schema()->dropIfExists('players');
|
|
| 16 | - Capsule::schema()->create('players', function (Blueprint $table) {
|
|
| 17 | - $table->increments('id');
|
|
| 18 | - $table->string('name');
|
|
| 19 | - $table->string('surname');
|
|
| 20 | - $table->tinyInteger('age');
|
|
| 21 | - $table->string('nationality',2);
|
|
| 22 | - $table->float('skillAvg');
|
|
| 23 | - $table->float('wageReq');
|
|
| 24 | - $table->float('val');
|
|
| 25 | - $table->string('role',2);
|
|
| 26 | - $table->integer('team_id')->nullable();
|
|
| 27 | - $table->timestamps(); |
|
| 28 | - }); |
|
| 29 | - } |
|
| 8 | + /** |
|
| 9 | + * Run the migrations. |
|
| 10 | + * |
|
| 11 | + * @return void |
|
| 12 | + */ |
|
| 13 | + public function run() |
|
| 14 | + {
|
|
| 15 | + Capsule::schema()->dropIfExists('players');
|
|
| 16 | + Capsule::schema()->create('players', function (Blueprint $table) {
|
|
| 17 | + $table->increments('id');
|
|
| 18 | + $table->string('name');
|
|
| 19 | + $table->string('surname');
|
|
| 20 | + $table->tinyInteger('age');
|
|
| 21 | + $table->string('nationality',2);
|
|
| 22 | + $table->float('skillAvg');
|
|
| 23 | + $table->float('wageReq');
|
|
| 24 | + $table->float('val');
|
|
| 25 | + $table->string('role',2);
|
|
| 26 | + $table->integer('team_id')->nullable();
|
|
| 27 | + $table->timestamps(); |
|
| 28 | + }); |
|
| 29 | + } |
|
| 30 | 30 | } |
@@ -4,9 +4,9 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | $dotenv = new Dotenv\Dotenv(__DIR__ . "/../"); |
| 6 | 6 | try {
|
| 7 | - $dotenv->load(); |
|
| 7 | + $dotenv->load(); |
|
| 8 | 8 | } catch (Exception $e) {
|
| 9 | - //yummy exception |
|
| 9 | + //yummy exception |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | /** |
@@ -14,14 +14,14 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | $capsule = new Capsule; |
| 16 | 16 | $capsule->addConnection(array( |
| 17 | - 'driver' => 'mysql', |
|
| 18 | - 'host' => 'localhost', |
|
| 19 | - 'database' => 'dsmanager', |
|
| 20 | - 'username' => getenv('USERNAME'),
|
|
| 21 | - 'password' => getenv('PASSWORD'),
|
|
| 22 | - 'charset' => 'utf8', |
|
| 23 | - 'collation' => 'utf8_general_ci', |
|
| 24 | - 'prefix' => '' |
|
| 17 | + 'driver' => 'mysql', |
|
| 18 | + 'host' => 'localhost', |
|
| 19 | + 'database' => 'dsmanager', |
|
| 20 | + 'username' => getenv('USERNAME'),
|
|
| 21 | + 'password' => getenv('PASSWORD'),
|
|
| 22 | + 'charset' => 'utf8', |
|
| 23 | + 'collation' => 'utf8_general_ci', |
|
| 24 | + 'prefix' => '' |
|
| 25 | 25 | )); |
| 26 | 26 | $capsule->setAsGlobal(); |
| 27 | 27 | $capsule->bootEloquent(); |
@@ -3,20 +3,20 @@ |
||
| 3 | 3 | |
| 4 | 4 | class BMatchesSeeder |
| 5 | 5 | { |
| 6 | - function run() |
|
| 7 | - { |
|
| 8 | - $teams = \App\Lib\DsManager\Models\Orm\Team::all()->toArray(); |
|
| 9 | - $halfTheTeams = count($teams) / 2; |
|
| 10 | - $chunks = array_chunk($teams, $halfTheTeams); |
|
| 11 | - $teamsSlice1 = $chunks[0]; |
|
| 12 | - $teamsSlice2 = $chunks[1]; |
|
| 13 | - for ($i = 0; $i < $halfTheTeams; $i++) { |
|
| 14 | - \App\Lib\DsManager\Models\Orm\Match::create( |
|
| 15 | - [ |
|
| 16 | - 'home_team_id' => $teamsSlice1[$i]['id'], |
|
| 17 | - 'away_team_id' => $teamsSlice2[$i]['id'] |
|
| 18 | - ] |
|
| 19 | - ); |
|
| 20 | - } |
|
| 21 | - } |
|
| 6 | + function run() |
|
| 7 | + { |
|
| 8 | + $teams = \App\Lib\DsManager\Models\Orm\Team::all()->toArray(); |
|
| 9 | + $halfTheTeams = count($teams) / 2; |
|
| 10 | + $chunks = array_chunk($teams, $halfTheTeams); |
|
| 11 | + $teamsSlice1 = $chunks[0]; |
|
| 12 | + $teamsSlice2 = $chunks[1]; |
|
| 13 | + for ($i = 0; $i < $halfTheTeams; $i++) { |
|
| 14 | + \App\Lib\DsManager\Models\Orm\Match::create( |
|
| 15 | + [ |
|
| 16 | + 'home_team_id' => $teamsSlice1[$i]['id'], |
|
| 17 | + 'away_team_id' => $teamsSlice2[$i]['id'] |
|
| 18 | + ] |
|
| 19 | + ); |
|
| 20 | + } |
|
| 21 | + } |
|
| 22 | 22 | } |
| 23 | 23 | \ No newline at end of file |
@@ -5,24 +5,24 @@ |
||
| 5 | 5 | |
| 6 | 6 | class CreateMatchTable |
| 7 | 7 | { |
| 8 | - /** |
|
| 9 | - * Run the migrations. |
|
| 10 | - * |
|
| 11 | - * @return void |
|
| 12 | - */ |
|
| 13 | - public function run() |
|
| 14 | - { |
|
| 15 | - Capsule::schema()->dropIfExists('matches'); |
|
| 16 | - Capsule::schema()->create('matches', function (Blueprint $table) { |
|
| 17 | - $table->increments('id'); |
|
| 18 | - $table->integer('home_team_id'); |
|
| 19 | - $table->integer('goal_home')->default(0); |
|
| 20 | - $table->integer('away_team_id'); |
|
| 21 | - $table->integer('goal_away')->default(0); |
|
| 22 | - $table->boolean('simulated')->default(false); |
|
| 23 | - $table->text('info')->nullable(); |
|
| 24 | - $table->date('match_date')->default(\Carbon\Carbon::now()); |
|
| 25 | - $table->timestamps(); |
|
| 26 | - }); |
|
| 27 | - } |
|
| 8 | + /** |
|
| 9 | + * Run the migrations. |
|
| 10 | + * |
|
| 11 | + * @return void |
|
| 12 | + */ |
|
| 13 | + public function run() |
|
| 14 | + { |
|
| 15 | + Capsule::schema()->dropIfExists('matches'); |
|
| 16 | + Capsule::schema()->create('matches', function (Blueprint $table) { |
|
| 17 | + $table->increments('id'); |
|
| 18 | + $table->integer('home_team_id'); |
|
| 19 | + $table->integer('goal_home')->default(0); |
|
| 20 | + $table->integer('away_team_id'); |
|
| 21 | + $table->integer('goal_away')->default(0); |
|
| 22 | + $table->boolean('simulated')->default(false); |
|
| 23 | + $table->text('info')->nullable(); |
|
| 24 | + $table->date('match_date')->default(\Carbon\Carbon::now()); |
|
| 25 | + $table->timestamps(); |
|
| 26 | + }); |
|
| 27 | + } |
|
| 28 | 28 | } |