@@ -4,7 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | $user1 = $item->team1 != null ? $item->team1->name : "Bye"; |
| 6 | 6 | $user2 = $item->team2 != null ? $item->team2->name : "Bye"; |
| 7 | - }else{ |
|
| 7 | + } else{ |
|
| 8 | 8 | $user1 = $item->user1 != null ? $item->user1->name : "Bye"; |
| 9 | 9 | $user2 = $item->user2 != null ? $item->user2->name : "Bye"; |
| 10 | 10 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | } else if ($this->championship->isDirectEliminationType()) { |
| 71 | 71 | $roundRobinGroups = $users->chunk(2)->shuffle(); |
| 72 | - }else{ |
|
| 72 | + } else{ |
|
| 73 | 73 | $roundRobinGroups = new Collection(); |
| 74 | 74 | |
| 75 | 75 | // Not so good, Round Robin has no trees |
@@ -106,11 +106,21 @@ discard block |
||
| 106 | 106 | $c4 = $robinGroup->get(3); |
| 107 | 107 | $c5 = $robinGroup->get(4); |
| 108 | 108 | |
| 109 | - if (isset($c1)) $pt->c1 = $c1->id; |
|
| 110 | - if (isset($c2)) $pt->c2 = $c2->id; |
|
| 111 | - if (isset($c3)) $pt->c3 = $c3->id; |
|
| 112 | - if (isset($c4)) $pt->c4 = $c4->id; |
|
| 113 | - if (isset($c5)) $pt->c5 = $c5->id; |
|
| 109 | + if (isset($c1)) { |
|
| 110 | + $pt->c1 = $c1->id; |
|
| 111 | + } |
|
| 112 | + if (isset($c2)) { |
|
| 113 | + $pt->c2 = $c2->id; |
|
| 114 | + } |
|
| 115 | + if (isset($c3)) { |
|
| 116 | + $pt->c3 = $c3->id; |
|
| 117 | + } |
|
| 118 | + if (isset($c4)) { |
|
| 119 | + $pt->c4 = $c4->id; |
|
| 120 | + } |
|
| 121 | + if (isset($c5)) { |
|
| 122 | + $pt->c5 = $c5->id; |
|
| 123 | + } |
|
| 114 | 124 | $pt->save(); |
| 115 | 125 | $trees->push($pt); |
| 116 | 126 | $order++; |
@@ -43,17 +43,37 @@ |
||
| 43 | 43 | } else { |
| 44 | 44 | $fighters = new Collection; |
| 45 | 45 | if ($championship->category->isTeam) { |
| 46 | - if ($treeGroup->c1 != null) $fighters->push($treeGroup->team1); |
|
| 47 | - if ($treeGroup->c2 != null) $fighters->push($treeGroup->team2); |
|
| 48 | - if ($treeGroup->c3 != null) $fighters->push($treeGroup->team3); |
|
| 49 | - if ($treeGroup->c4 != null) $fighters->push($treeGroup->team4); |
|
| 50 | - if ($treeGroup->c5 != null) $fighters->push($treeGroup->team5); |
|
| 46 | + if ($treeGroup->c1 != null) { |
|
| 47 | + $fighters->push($treeGroup->team1); |
|
| 48 | + } |
|
| 49 | + if ($treeGroup->c2 != null) { |
|
| 50 | + $fighters->push($treeGroup->team2); |
|
| 51 | + } |
|
| 52 | + if ($treeGroup->c3 != null) { |
|
| 53 | + $fighters->push($treeGroup->team3); |
|
| 54 | + } |
|
| 55 | + if ($treeGroup->c4 != null) { |
|
| 56 | + $fighters->push($treeGroup->team4); |
|
| 57 | + } |
|
| 58 | + if ($treeGroup->c5 != null) { |
|
| 59 | + $fighters->push($treeGroup->team5); |
|
| 60 | + } |
|
| 51 | 61 | } else { |
| 52 | - if ($treeGroup->c1 != null) $fighters->push($treeGroup->user1); |
|
| 53 | - if ($treeGroup->c2 != null) $fighters->push($treeGroup->user2); |
|
| 54 | - if ($treeGroup->c3 != null) $fighters->push($treeGroup->user3); |
|
| 55 | - if ($treeGroup->c4 != null) $fighters->push($treeGroup->user4); |
|
| 56 | - if ($treeGroup->c5 != null) $fighters->push($treeGroup->user5); |
|
| 62 | + if ($treeGroup->c1 != null) { |
|
| 63 | + $fighters->push($treeGroup->user1); |
|
| 64 | + } |
|
| 65 | + if ($treeGroup->c2 != null) { |
|
| 66 | + $fighters->push($treeGroup->user2); |
|
| 67 | + } |
|
| 68 | + if ($treeGroup->c3 != null) { |
|
| 69 | + $fighters->push($treeGroup->user3); |
|
| 70 | + } |
|
| 71 | + if ($treeGroup->c4 != null) { |
|
| 72 | + $fighters->push($treeGroup->user4); |
|
| 73 | + } |
|
| 74 | + if ($treeGroup->c5 != null) { |
|
| 75 | + $fighters->push($treeGroup->user5); |
|
| 76 | + } |
|
| 57 | 77 | } |
| 58 | 78 | } |
| 59 | 79 | if ($championship->category->isTeam) { |
@@ -6,47 +6,47 @@ |
||
| 6 | 6 | |
| 7 | 7 | class CreateTournamentTable extends Migration { |
| 8 | 8 | |
| 9 | - public function up() |
|
| 10 | - { |
|
| 11 | - Schema::create('tournament', function(Blueprint $table) { |
|
| 12 | - $table->increments('id'); |
|
| 9 | + public function up() |
|
| 10 | + { |
|
| 11 | + Schema::create('tournament', function(Blueprint $table) { |
|
| 12 | + $table->increments('id'); |
|
| 13 | 13 | $table->Integer('user_id')->unsigned()->index(); |
| 14 | - $table->foreign('user_id') |
|
| 15 | - ->references('id') |
|
| 16 | - ->on('users') |
|
| 17 | - ->onUpdate('cascade') |
|
| 18 | - ->onDelete('cascade'); |
|
| 14 | + $table->foreign('user_id') |
|
| 15 | + ->references('id') |
|
| 16 | + ->on('users') |
|
| 17 | + ->onUpdate('cascade') |
|
| 18 | + ->onDelete('cascade'); |
|
| 19 | 19 | |
| 20 | - $table->string('name'); |
|
| 21 | - $table->string('slug')->default('')->unique(); |
|
| 20 | + $table->string('name'); |
|
| 21 | + $table->string('slug')->default('')->unique(); |
|
| 22 | 22 | |
| 23 | - $table->date('dateIni'); |
|
| 24 | - $table->date('dateFin'); |
|
| 23 | + $table->date('dateIni'); |
|
| 24 | + $table->date('dateFin'); |
|
| 25 | 25 | $table->date('registerDateLimit'); |
| 26 | 26 | $table->integer('sport')->unsigned()->default(1); // Default is Kendo for now |
| 27 | - $table->string('promoter')->nullable(); |
|
| 28 | - $table->string('host_organization')->nullable(); |
|
| 29 | - $table->string('technical_assistance')->nullable(); |
|
| 30 | - $table->integer('rule_id')->default(1); |
|
| 27 | + $table->string('promoter')->nullable(); |
|
| 28 | + $table->string('host_organization')->nullable(); |
|
| 29 | + $table->string('technical_assistance')->nullable(); |
|
| 30 | + $table->integer('rule_id')->default(1); |
|
| 31 | 31 | $table->tinyInteger('type')->default(1); // 1= local, 2= state, 3= national, 4=continent, 5=world |
| 32 | 32 | $table->integer("venue_id")->nullable()->unsigned(); |
| 33 | - $table->integer("level_id")->unsigned()->default(1); |
|
| 33 | + $table->integer("level_id")->unsigned()->default(1); |
|
| 34 | 34 | |
| 35 | 35 | $table->foreign('venue_id') |
| 36 | 36 | ->references('id') |
| 37 | 37 | ->on('venue'); |
| 38 | 38 | |
| 39 | - $table->timestamps(); |
|
| 40 | - $table->softDeletes(); |
|
| 41 | - $table->engine = 'InnoDB'; |
|
| 39 | + $table->timestamps(); |
|
| 40 | + $table->softDeletes(); |
|
| 41 | + $table->engine = 'InnoDB'; |
|
| 42 | 42 | |
| 43 | - }); |
|
| 44 | - } |
|
| 43 | + }); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - public function down() |
|
| 47 | - { |
|
| 48 | - DB::statement('SET FOREIGN_KEY_CHECKS = 0'); |
|
| 49 | - Schema::dropIfExists('tournament'); |
|
| 50 | - DB::statement('SET FOREIGN_KEY_CHECKS = 1'); |
|
| 51 | - } |
|
| 46 | + public function down() |
|
| 47 | + { |
|
| 48 | + DB::statement('SET FOREIGN_KEY_CHECKS = 0'); |
|
| 49 | + Schema::dropIfExists('tournament'); |
|
| 50 | + DB::statement('SET FOREIGN_KEY_CHECKS = 1'); |
|
| 51 | + } |
|
| 52 | 52 | } |
| 53 | 53 | \ No newline at end of file |