Files
crewli/api/database/factories/EventFactory.php
bert.hausmans c776331cf8 feat: festival/event model frontend + topbar activeren
- Events lijst: card grid met festival/serie chips
- Festival detail: programmaonderdelen grid
- CreateSubEventDialog voor sub-events binnen festival
- EventTabsNav: breadcrumb terug naar festival
- Sessie A: festival-bewuste EventResource + children endpoint
- Topbar: zoekbalk, theme switcher, shortcuts, notificaties
- Schema v1.7 + BACKLOG.md toegevoegd
- 121 tests groen
2026-04-08 10:06:47 +02:00

66 lines
1.7 KiB
PHP

<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Models\Event;
use App\Models\Organisation;
use Illuminate\Database\Eloquent\Factories\Factory;
/** @extends Factory<Event> */
final class EventFactory extends Factory
{
/** @return array<string, mixed> */
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',
]);
}
}