*/ final class EventFactory extends Factory { /** @return array */ public function definition(): array { $city = fake('nl_NL')->city(); $year = fake()->year('+2 years'); $name = "Festival {$city} {$year}"; $startDate = fake()->dateTimeBetween('+1 month', '+6 months'); return [ 'organisation_id' => Organisation::factory(), 'name' => $name, 'slug' => str($name)->slug()->toString(), 'start_date' => $startDate, 'end_date' => fake()->dateTimeBetween($startDate, (clone $startDate)->modify('+3 days')), 'timezone' => 'Europe/Amsterdam', 'status' => 'draft', 'event_type' => 'event', ]; } public function published(): static { return $this->state(fn () => ['status' => 'published']); } public function festival(): static { return $this->state(fn () => [ 'event_type' => 'festival', 'event_type_label' => 'Festival', 'sub_event_label' => 'Dag', ]); } public function series(): static { return $this->state(fn () => [ 'event_type' => 'series', 'event_type_label' => 'Serie', 'sub_event_label' => 'Editie', ]); } public function subEvent(Event $parent): static { return $this->state(fn () => [ 'parent_event_id' => $parent->id, 'organisation_id' => $parent->organisation_id, 'event_type' => 'event', ]); } }