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>
58 lines
1.8 KiB
PHP
58 lines
1.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Artist;
|
|
use App\Models\Company;
|
|
use App\Models\Genre;
|
|
use App\Models\Organisation;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
|
|
/** @extends Factory<Artist> */
|
|
final class ArtistFactory extends Factory
|
|
{
|
|
/** @return array<string, mixed> */
|
|
public function definition(): array
|
|
{
|
|
$name = fake()->unique()->company().' '.fake()->randomElement(['Live', 'Sound', 'Project', 'Collective', 'DJ Set']);
|
|
|
|
return [
|
|
'organisation_id' => Organisation::factory(),
|
|
'name' => $name,
|
|
'slug' => Str::slug($name).'-'.Str::lower(Str::random(4)),
|
|
'default_genre_id' => null,
|
|
'default_draw' => fake()->numberBetween(50, 5000),
|
|
'star_rating' => fake()->numberBetween(1, 5),
|
|
'home_base_country' => fake()->randomElement(['NL', 'BE', 'DE', 'FR', 'UK']),
|
|
'agent_company_id' => null,
|
|
'notes' => null,
|
|
];
|
|
}
|
|
|
|
public function withGenre(?Genre $genre = null): static
|
|
{
|
|
return $this->state(function (array $attrs) use ($genre): array {
|
|
$resolved = $genre ?? Genre::factory()->create([
|
|
'organisation_id' => $attrs['organisation_id'],
|
|
]);
|
|
|
|
return ['default_genre_id' => $resolved->id];
|
|
});
|
|
}
|
|
|
|
public function withAgent(?Company $company = null): static
|
|
{
|
|
return $this->state(function (array $attrs) use ($company): array {
|
|
$resolved = $company ?? Company::factory()->create([
|
|
'organisation_id' => $attrs['organisation_id'],
|
|
'type' => 'agency',
|
|
]);
|
|
|
|
return ['agent_company_id' => $resolved->id];
|
|
});
|
|
}
|
|
}
|