Files
crewli/api/app/Models/FestivalSection.php
bert.hausmans c21bc085e9 feat: registration section preferences with show_in_registration filtering and deduplication
Add show_in_registration and registration_description columns to festival_sections.
Registration form now shows deduplicated sections by name (across sub-events),
filtered by show_in_registration=true, grouped by category with card-based UI.
Section preferences use section_name instead of section_id.
Add GET/PUT registration-settings endpoints for festival-level bulk management.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 20:03:54 +02:00

67 lines
1.6 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
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;
final class FestivalSection extends Model
{
use HasFactory;
use HasUlids;
use SoftDeletes;
protected $fillable = [
'event_id',
'name',
'category',
'icon',
'type',
'sort_order',
'crew_need',
'crew_auto_accepts',
'crew_invited_to_events',
'added_to_timeline',
'responder_self_checkin',
'crew_accreditation_level',
'public_form_accreditation_level',
'timed_accreditations',
'show_in_registration',
'registration_description',
];
protected function casts(): array
{
return [
'crew_auto_accepts' => 'boolean',
'crew_invited_to_events' => 'boolean',
'added_to_timeline' => 'boolean',
'responder_self_checkin' => 'boolean',
'timed_accreditations' => 'boolean',
'show_in_registration' => 'boolean',
];
}
public function event(): BelongsTo
{
return $this->belongsTo(Event::class);
}
public function shifts(): HasMany
{
return $this->hasMany(Shift::class);
}
public function scopeOrdered(Builder $query): Builder
{
return $query->orderBy('sort_order');
}
}