From: Daniel Karbach Date: Fri, 25 Mar 2022 11:08:14 +0000 (+0100) Subject: no_record rounds and tournaments X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=df75af8d30ceb44724280829b948dd01e86de07b;p=alttp.git no_record rounds and tournaments --- diff --git a/app/Http/Controllers/RoundController.php b/app/Http/Controllers/RoundController.php index 4938b3a..d616b86 100644 --- a/app/Http/Controllers/RoundController.php +++ b/app/Http/Controllers/RoundController.php @@ -23,6 +23,7 @@ class RoundController extends Controller $round = Round::create([ 'number' => intval($tournament->rounds_max_number) + 1, + 'no_record' => $tournament->no_record, 'tournament_id' => $validatedData['tournament_id'], ]); diff --git a/app/Models/Round.php b/app/Models/Round.php index 3777df9..2232a0e 100644 --- a/app/Models/Round.php +++ b/app/Models/Round.php @@ -69,6 +69,7 @@ class Round extends Model protected $fillable = [ 'number', + 'no_record', 'tournament_id', ]; diff --git a/app/Models/User.php b/app/Models/User.php index b4950c3..89493e7 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -59,37 +59,43 @@ class User extends Authenticatable public function round_first() { return $this->rounds() - ->whereNot('locked') + ->where('locked', true) + ->where('no_record', false) ->wherePivot('placement', 1); } public function round_second() { return $this->rounds() - ->whereNot('locked') + ->where('locked', true) + ->where('no_record', false) ->wherePivot('placement', 2); } public function round_third() { return $this->rounds() - ->whereNot('locked') + ->where('locked', true) + ->where('no_record', false) ->wherePivot('placement', 3); } public function tournament_first() { return $this->tournaments() - ->whereNot('locked') + ->where('locked', true) + ->where('no_record', false) ->wherePivot('placement', 1); } public function tournament_second() { return $this->tournaments() - ->whereNot('locked') + ->where('locked', true) + ->where('no_record', false) ->wherePivot('placement', 2); } public function tournament_third() { return $this->tournaments() - ->whereNot('locked') + ->where('locked', true) + ->where('no_record', false) ->wherePivot('placement', 3); } diff --git a/database/migrations/2022_03_25_110011_no_record.php b/database/migrations/2022_03_25_110011_no_record.php new file mode 100644 index 0000000..1874d7c --- /dev/null +++ b/database/migrations/2022_03_25_110011_no_record.php @@ -0,0 +1,38 @@ +boolean('no_record')->default(false); + }); + Schema::table('tournaments', function(Blueprint $table) { + $table->boolean('no_record')->default(false); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('rounds', function(Blueprint $table) { + $table->dropColumn('no_record'); + }); + Schema::table('tournaments', function(Blueprint $table) { + $table->dropColumn('no_record'); + }); + } +};