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>
71 lines
1.7 KiB
PHP
71 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\Artist\AdvanceSubmissionStatus;
|
|
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 Spatie\Activitylog\Models\Concerns\LogsActivity;
|
|
use Spatie\Activitylog\Support\LogOptions;
|
|
|
|
final class AdvanceSubmission extends Model
|
|
{
|
|
use HasFactory;
|
|
use HasUlids;
|
|
use LogsActivity;
|
|
|
|
protected static function booted(): void
|
|
{
|
|
self::addGlobalScope(new OrganisationScope);
|
|
}
|
|
|
|
/** @return array{via: class-string, fk: string} */
|
|
public static function tenantScopeStrategy(): array
|
|
{
|
|
return ['via' => AdvanceSection::class, 'fk' => 'advance_section_id'];
|
|
}
|
|
|
|
protected $fillable = [
|
|
'advance_section_id',
|
|
'submitted_by_name',
|
|
'submitted_by_email',
|
|
'submitted_at',
|
|
'status',
|
|
'reviewed_by',
|
|
'reviewed_at',
|
|
'data',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'status' => AdvanceSubmissionStatus::class,
|
|
'submitted_at' => 'datetime',
|
|
'reviewed_at' => 'datetime',
|
|
'data' => 'array',
|
|
];
|
|
}
|
|
|
|
public function getActivitylogOptions(): LogOptions
|
|
{
|
|
return LogOptions::defaults()
|
|
->logFillable()
|
|
->dontLogEmptyChanges();
|
|
}
|
|
|
|
public function section(): BelongsTo
|
|
{
|
|
return $this->belongsTo(AdvanceSection::class, 'advance_section_id');
|
|
}
|
|
|
|
public function reviewer(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'reviewed_by');
|
|
}
|
|
}
|