63 lines
1.7 KiB
PHP
63 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Event;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Audition>
|
|
*/
|
|
class AuditionFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
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',
|
|
];
|
|
|
|
$event = Event::factory()->create();
|
|
|
|
return [
|
|
'event_id' => $event->id,
|
|
#'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,
|
|
];
|
|
}
|
|
|
|
public function closed(?Carbon $entryDeadline = null): self
|
|
{
|
|
return $this->state(
|
|
fn (array $attributes) => ['entry_deadline' => $entryDeadline ?? Carbon::yesterday()]
|
|
);
|
|
}
|
|
}
|