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>
124 lines
3.3 KiB
PHP
124 lines
3.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\Artist\ArtistEngagementStatus;
|
|
use App\Enums\Artist\BumaHandledBy;
|
|
use App\Enums\Artist\FeeType;
|
|
use App\Enums\Artist\PaymentStatus;
|
|
use App\Models\Scopes\OrganisationScope;
|
|
use Illuminate\Database\Eloquent\Concerns\HasUlids;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
|
use Spatie\Activitylog\Support\LogOptions;
|
|
|
|
final class ArtistEngagement extends Model
|
|
{
|
|
use HasFactory;
|
|
use HasUlids;
|
|
use LogsActivity;
|
|
use SoftDeletes;
|
|
|
|
protected static function booted(): void
|
|
{
|
|
self::addGlobalScope(new OrganisationScope);
|
|
}
|
|
|
|
protected $fillable = [
|
|
'organisation_id',
|
|
'artist_id',
|
|
'event_id',
|
|
'booking_status',
|
|
'project_leader_id',
|
|
'fee_amount',
|
|
'fee_currency',
|
|
'fee_type',
|
|
'buma_applicable',
|
|
'buma_percentage',
|
|
'buma_handled_by',
|
|
'vat_applicable',
|
|
'vat_percentage',
|
|
'deal_breakdown',
|
|
'deposit_percentage',
|
|
'deposit_due_date',
|
|
'balance_due_date',
|
|
'payment_status',
|
|
'crew_count',
|
|
'guests_count',
|
|
'requested_at',
|
|
'option_expires_at',
|
|
'advance_open_from',
|
|
'advance_open_to',
|
|
'portal_token',
|
|
'advancing_completed_count',
|
|
'advancing_total_count',
|
|
'notes',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'booking_status' => ArtistEngagementStatus::class,
|
|
'fee_type' => FeeType::class,
|
|
'buma_handled_by' => BumaHandledBy::class,
|
|
'payment_status' => PaymentStatus::class,
|
|
'buma_applicable' => 'boolean',
|
|
'vat_applicable' => 'boolean',
|
|
'deal_breakdown' => 'array',
|
|
'deposit_due_date' => 'date',
|
|
'balance_due_date' => 'date',
|
|
'crew_count' => 'integer',
|
|
'guests_count' => 'integer',
|
|
'requested_at' => 'datetime',
|
|
'option_expires_at' => 'datetime',
|
|
'advance_open_from' => 'datetime',
|
|
'advance_open_to' => 'datetime',
|
|
'advancing_completed_count' => 'integer',
|
|
'advancing_total_count' => 'integer',
|
|
];
|
|
}
|
|
|
|
public function getActivitylogOptions(): LogOptions
|
|
{
|
|
return LogOptions::defaults()
|
|
->logFillable()
|
|
->dontLogEmptyChanges();
|
|
}
|
|
|
|
public function organisation(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Organisation::class);
|
|
}
|
|
|
|
public function artist(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Artist::class);
|
|
}
|
|
|
|
public function event(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Event::class);
|
|
}
|
|
|
|
public function projectLeader(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'project_leader_id');
|
|
}
|
|
|
|
public function performances(): HasMany
|
|
{
|
|
return $this->hasMany(Performance::class, 'engagement_id');
|
|
}
|
|
|
|
public function advanceSections(): HasMany
|
|
{
|
|
return $this->hasMany(AdvanceSection::class, 'engagement_id');
|
|
}
|
|
}
|