diff --git a/app/Models/Room.php b/app/Models/Room.php index 233819a..0f9ce67 100644 --- a/app/Models/Room.php +++ b/app/Models/Room.php @@ -11,6 +11,8 @@ use Illuminate\Database\Eloquent\Relations\HasManyThrough; class Room extends Model { use HasFactory; + protected $guarded = []; + //TODO can a user add rooms? public function auditions(): HasMany { diff --git a/database/migrations/2024_06_04_164348_add_room_columns_to_auditions_table.php b/database/migrations/2024_06_04_164348_add_room_columns_to_auditions_table.php index b51b6c8..163ea44 100644 --- a/database/migrations/2024_06_04_164348_add_room_columns_to_auditions_table.php +++ b/database/migrations/2024_06_04_164348_add_room_columns_to_auditions_table.php @@ -14,7 +14,7 @@ return new class extends Migration { Schema::table('auditions', function (Blueprint $table) { $table->foreignIdFor(Room::class)->nullable()->constrained()->cascadeOnUpdate()->nullOnDelete(); - $table->integer('order_in_room'); + $table->integer('order_in_room')->default(0); }); } diff --git a/database/seeders/AuditionSeeder.php b/database/seeders/AuditionSeeder.php index 66d6cd3..af87b75 100644 --- a/database/seeders/AuditionSeeder.php +++ b/database/seeders/AuditionSeeder.php @@ -13,7 +13,7 @@ class AuditionSeeder extends Seeder * Run the database seeds. */ public function run(): void - { + { //TODO: Seed scoring guides for the auditions - Probably need percussion and wind $event = Event::factory()->create([ 'name' => 'Concert Band Auditions' ]); diff --git a/database/seeders/EntrySeeder.php b/database/seeders/EntrySeeder.php index d6a1964..71c4a16 100644 --- a/database/seeders/EntrySeeder.php +++ b/database/seeders/EntrySeeder.php @@ -7,6 +7,7 @@ use App\Models\Entry; use App\Models\Student; use Illuminate\Database\Console\Seeds\WithoutModelEvents; use Illuminate\Database\Seeder; +use function mt_rand; use function rand; use function random_int; @@ -35,7 +36,7 @@ class EntrySeeder extends Seeder 'audition_id' => $audition->id ]); - if (random_int(1,100) > 80) { + if (mt_rand(1,100) > 90) { if($student->grade > 9) $audition2 = Audition::where('maximum_grade','=','12')->where('id','!=',$audition->id)->inRandomOrder()->first(); if($student->grade == 9) $audition2 = Audition::where('maximum_grade','>','8')->where('id','!=',$audition->id)->inRandomOrder()->first(); if($student->grade == 8) $audition2 = Audition::where('maximum_grade','=','9')->where('id','!=',$audition->id)->inRandomOrder()->first(); @@ -47,7 +48,7 @@ class EntrySeeder extends Seeder ]); } - if (random_int(1,100) > 80) { + if (mt_rand(1,100) > 90) { if($student->grade > 9) $audition3 = Audition::where('maximum_grade','=','12')->where('id','!=',$audition->id)->where('id','!=',$audition2->id)->inRandomOrder()->first(); if($student->grade == 9) $audition3 = Audition::where('maximum_grade','>','8')->where('id','!=',$audition->id)->where('id','!=',$audition2->id)->inRandomOrder()->first(); if($student->grade == 8) $audition3 = Audition::where('maximum_grade','=','9')->where('id','!=',$audition->id)->where('id','!=',$audition2->id)->inRandomOrder()->first();