Update EntrySeeder.php

Fix entry seeder
This commit is contained in:
Matt Young 2025-06-11 10:13:04 -05:00
parent 551f04588c
commit c2572414e6
1 changed files with 27 additions and 24 deletions

View File

@ -36,7 +36,7 @@ class EntrySeeder extends Seeder
$audition = Audition::where('maximum_grade', '=', '7')->inRandomOrder()->first(); $audition = Audition::where('maximum_grade', '=', '7')->inRandomOrder()->first();
} }
Entry::factory()->create([ Entry::create([
'student_id' => $student->id, 'student_id' => $student->id,
'audition_id' => $audition->id, 'audition_id' => $audition->id,
]); ]);
@ -59,12 +59,12 @@ class EntrySeeder extends Seeder
$audition->id)->inRandomOrder()->first(); $audition->id)->inRandomOrder()->first();
} }
Entry::factory()->create([ Entry::create([
'student_id' => $student->id, 'student_id' => $student->id,
'audition_id' => $audition2->id, 'audition_id' => $audition2->id,
]); ]);
}
// Triplers are possible
if (mt_rand(1, 100) > 90) { if (mt_rand(1, 100) > 90) {
if ($student->grade > 9) { if ($student->grade > 9) {
$audition3 = Audition::where('maximum_grade', '=', '12')->where('id', '!=', $audition3 = Audition::where('maximum_grade', '=', '12')->where('id', '!=',
@ -83,11 +83,14 @@ class EntrySeeder extends Seeder
$audition->id)->where('id', '!=', $audition2->id)->inRandomOrder()->first(); $audition->id)->where('id', '!=', $audition2->id)->inRandomOrder()->first();
} }
Entry::factory()->create([ Entry::create([
'student_id' => $student->id, 'student_id' => $student->id,
'audition_id' => $audition3->id, 'audition_id' => $audition3->id,
]); ]);
} }
} }
}
} }
} }