Fix audition factory to only create event if one is not provided.

This commit is contained in:
Matt Young 2025-07-01 09:59:10 -05:00
parent 42894c40c1
commit b4bf94d9f8
1 changed files with 4 additions and 5 deletions

View File

@ -37,12 +37,10 @@ class AuditionFactory extends Factory
'Percussion', 'Percussion',
]; ];
$event = Event::factory()->create();
return [ return [
'event_id' => $event->id, 'event_id' => Event::factory(),
#'name' => $this->faker->randomElement($instruments).$this->faker->numberBetween(1, 1000), //'name' => $this->faker->randomElement($instruments).$this->faker->numberBetween(1, 1000),
'name' => 'New Instrument ' . $this->faker->unique()->words(4,true), 'name' => 'New Instrument '.$this->faker->unique()->words(4, true),
'score_order' => $this->faker->numberBetween(2, 50), 'score_order' => $this->faker->numberBetween(2, 50),
'entry_deadline' => Carbon::tomorrow(), 'entry_deadline' => Carbon::tomorrow(),
'entry_fee' => 1000, 'entry_fee' => 1000,
@ -62,6 +60,7 @@ class AuditionFactory extends Factory
fn (array $attributes) => ['entry_deadline' => $entryDeadline ?? Carbon::yesterday()] fn (array $attributes) => ['entry_deadline' => $entryDeadline ?? Carbon::yesterday()]
); );
} }
public function seatingOnly(): self public function seatingOnly(): self
{ {
return $this->state( return $this->state(