*/ class AuditionFactory extends Factory { /** * Define the model's default state. * * @return array */ public function definition(): array { $instruments = [ 'Flute', 'Oboe', 'Clarinet', 'Bass Clarinet', 'Contra Clarinet', 'Bassoon', 'Alto Sax', 'Tenor Sax', 'Bari Sax', 'Trumpet', 'Horn', 'Trombone', 'Euphonium', 'Tuba', 'String Bass', 'Percussion', ]; return [ 'event_id' => Event::factory(), //'name' => $this->faker->randomElement($instruments).$this->faker->numberBetween(1, 1000), 'name' => 'New Instrument '.$this->faker->unique()->words(4, true), 'score_order' => $this->faker->numberBetween(2, 50), 'entry_deadline' => Carbon::tomorrow(), 'entry_fee' => 1000, 'minimum_grade' => $this->faker->numberBetween(7, 9), 'maximum_grade' => $this->faker->numberBetween(8, 12), 'for_seating' => 1, 'for_advancement' => 1, 'room_id' => null, 'order_in_room' => 0, 'scoring_guide_id' => null, ]; } public function closed(?Carbon $entryDeadline = null): self { return $this->state( fn (array $attributes) => ['entry_deadline' => $entryDeadline ?? Carbon::yesterday()] ); } public function seatingOnly(): self { return $this->state( fn (array $attributes) => ['for_advancement' => 0] ); } public function advancementOnly(): self { return $this->state( fn (array $attributes) => ['for_seating' => 0] ); } public function forEvent(Event $event): self { return $this->state(function (array $attributes) use ($event) { return [ 'event_id' => $event->id, ]; }); } }