Eight factories with named states (Genre, Artist, ArtistContact, Stage, ArtistEngagement, Performance, AdvanceSection, AdvanceSubmission). ArtistTimetableDevSeeder hooked into DevSeeder::seedEchtFeesten after the form-builder showcase. Produces: - 4 stages (Mainstage, Havana, Stairway, Socialite) with prototype-style hex colours - 4 stages × 3 sub-events = 12 stage_days rows - 4 genres (Hardstyle, Techno, Indie, Live band) - 6 master artists, each with one tour-manager ArtistContact - 12 engagements with status mix (1 Draft, 2 Requested, 3 Option, 2 Confirmed, 3 Contracted, 1 Cancelled). Two artists have two engagements each (different sub-events) — exercises D17 multi- engagement-per-artist. - 13 performances, including one parked (stage_id=null = wachtrij) and one B2B pair within 3 minutes on Mainstage Saturday to seed the Session 4 frontend B2B detector. Also fix LogOptions method name across 8 models: dontSubmitEmptyLogs() → dontLogEmptyChanges() (Spatie's actual API; surfaced when DevSeeder ran). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
47 lines
1.4 KiB
PHP
47 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Enums\Artist\AdvanceSectionSubmissionStatus;
|
|
use App\Enums\Artist\AdvanceSectionType;
|
|
use App\Models\AdvanceSection;
|
|
use App\Models\ArtistEngagement;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/** @extends Factory<AdvanceSection> */
|
|
final class AdvanceSectionFactory extends Factory
|
|
{
|
|
/** @return array<string, mixed> */
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'engagement_id' => ArtistEngagement::factory(),
|
|
'name' => fake()->randomElement(['Gastenlijst', 'Contacts', 'Productie', 'Catering']),
|
|
'type' => fake()->randomElement(AdvanceSectionType::cases()),
|
|
'is_open' => false,
|
|
'sort_order' => 0,
|
|
'submission_status' => AdvanceSectionSubmissionStatus::Open,
|
|
];
|
|
}
|
|
|
|
public function open(): static
|
|
{
|
|
return $this->state(fn () => [
|
|
'is_open' => true,
|
|
'open_from' => now()->subDays(7),
|
|
'open_to' => now()->addDays(14),
|
|
'submission_status' => AdvanceSectionSubmissionStatus::Open,
|
|
]);
|
|
}
|
|
|
|
public function approved(): static
|
|
{
|
|
return $this->state(fn () => [
|
|
'submission_status' => AdvanceSectionSubmissionStatus::Approved,
|
|
'last_submitted_at' => now()->subDay(),
|
|
]);
|
|
}
|
|
}
|