- Crowd Types + Persons CRUD (73 tests) - Festival Sections + Time Slots + Shifts CRUD met assign/claim flow (84 tests) - Invite Flow + Member Management met InvitationService (109 tests) - Schema v1.6 migraties volledig uitgevoerd - DevSeeder bijgewerkt met crowd types voor testorganisatie
57 lines
1.2 KiB
PHP
57 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
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\BelongsToMany;
|
|
|
|
final class CrowdList extends Model
|
|
{
|
|
use HasFactory;
|
|
use HasUlids;
|
|
|
|
protected $fillable = [
|
|
'event_id',
|
|
'crowd_type_id',
|
|
'name',
|
|
'type',
|
|
'recipient_company_id',
|
|
'auto_approve',
|
|
'max_persons',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'auto_approve' => 'boolean',
|
|
'max_persons' => 'integer',
|
|
];
|
|
}
|
|
|
|
public function event(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Event::class);
|
|
}
|
|
|
|
public function crowdType(): BelongsTo
|
|
{
|
|
return $this->belongsTo(CrowdType::class);
|
|
}
|
|
|
|
public function recipientCompany(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Company::class, 'recipient_company_id');
|
|
}
|
|
|
|
public function persons(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Person::class, 'crowd_list_persons')
|
|
->withPivot('added_at', 'added_by_user_id');
|
|
}
|
|
}
|