'boolean', 'custom_fields' => 'array', ]; } public function event(): BelongsTo { return $this->belongsTo(Event::class); } public function crowdType(): BelongsTo { return $this->belongsTo(CrowdType::class); } public function company(): BelongsTo { return $this->belongsTo(Company::class); } public function user(): BelongsTo { return $this->belongsTo(User::class); } public function crowdLists(): BelongsToMany { return $this->belongsToMany(CrowdList::class, 'crowd_list_persons') ->withPivot('added_at', 'added_by_user_id'); } public function shiftAssignments(): HasMany { return $this->hasMany(ShiftAssignment::class); } public function scopeApproved(Builder $query): Builder { return $query->where('status', 'approved'); } public function scopePending(Builder $query): Builder { return $query->where('status', 'pending'); } public function scopeForCrowdType(Builder $query, string $type): Builder { return $query->whereHas('crowdType', fn (Builder $q) => $q->where('system_type', $type)); } }