| Foto-Erlaubnis: |
diff --git a/app/Models/Event.php b/app/Models/Event.php
index ffce8ee..6a7eb7e 100644
--- a/app/Models/Event.php
+++ b/app/Models/Event.php
@@ -87,6 +87,7 @@ class Event extends InstancedModel
'vat_pricing_mode',
'tax_exemption_reason',
'tax_exemption_note',
+ 'participation_options',
];
@@ -114,6 +115,8 @@ class Event extends InstancedModel
'tax_liable' => 'boolean',
'vat_rate' => 'integer',
+
+ 'participation_options' => 'array',
];
public function tenant(): BelongsTo
diff --git a/app/Models/EventParticipant.php b/app/Models/EventParticipant.php
index 23622a7..b61aca1 100644
--- a/app/Models/EventParticipant.php
+++ b/app/Models/EventParticipant.php
@@ -14,6 +14,7 @@ use App\EventPaymentModules\DTO\RegistrationSummaryResponse;
use App\EventPaymentModules\EventPaymentModule;
use App\EventPaymentModules\EventPaymentModuleRegistry;
use App\Scopes\InstancedModel;
+use Illuminate\Database\Eloquent\Relations\HasMany;
class EventParticipant extends InstancedModel
@@ -103,6 +104,12 @@ class EventParticipant extends InstancedModel
return $this->belongsTo(Event::class);
}
+ /** Gewählte Teilnahmeoptionen (event-spezifische Pflicht-Auswahl) dieser Anmeldung. */
+ public function selectedOptions(): HasMany
+ {
+ return $this->hasMany(EventParticipantOption::class, 'event_participant_id');
+ }
+
public function user()
{
return $this->belongsTo(User::class);
diff --git a/app/Models/EventParticipantOption.php b/app/Models/EventParticipantOption.php
new file mode 100644
index 0000000..726d76d
--- /dev/null
+++ b/app/Models/EventParticipantOption.php
@@ -0,0 +1,31 @@
+belongsTo(Event::class);
+ }
+
+ public function participant(): BelongsTo
+ {
+ return $this->belongsTo(EventParticipant::class, 'event_participant_id');
+ }
+}
diff --git a/app/Resources/EventParticipantOptionResource.php b/app/Resources/EventParticipantOptionResource.php
new file mode 100644
index 0000000..3a9d995
--- /dev/null
+++ b/app/Resources/EventParticipantOptionResource.php
@@ -0,0 +1,24 @@
+ $this->resource->question_key,
+ 'questionLabel' => $this->resource->question_label,
+ 'value' => $this->resource->value,
+ 'valueLabel' => $this->resource->value_label,
+ ];
+ }
+}
diff --git a/app/Resources/EventParticipantResource.php b/app/Resources/EventParticipantResource.php
index c5225a7..666e043 100644
--- a/app/Resources/EventParticipantResource.php
+++ b/app/Resources/EventParticipantResource.php
@@ -96,6 +96,8 @@ class EventParticipantResource extends JsonResource
'eventName' => $this->resource->event()->first()->name,
'arrivalDateReadable' => $this->resource->arrival_date->format('d.m.Y'),
'departureDateReadable' => $this->resource->departure_date->format('d.m.Y'),
+ 'participationOptions' => $this->resource->selectedOptions()->get()->map(
+ fn($option) => new EventParticipantOptionResource($option)->toArray($request))->toArray(),
]
);
}
diff --git a/app/Resources/EventResource.php b/app/Resources/EventResource.php
index 8da535c..aa59d21 100644
--- a/app/Resources/EventResource.php
+++ b/app/Resources/EventResource.php
@@ -138,6 +138,9 @@ class EventResource extends JsonResource{
$returnArray['paymentMethods'] = $this->event->paymentMethods()->get()->map(
fn($paymentMethod) => new AvailablePaymentMethodResource($paymentMethod)->toArray($request))->toArray();
+ // Veranstaltungsspezifische Pflicht-Auswahlfragen (Teilnahmeoptionen); leeres Array => Schritt entfällt.
+ $returnArray['participationOptions'] = $this->event->participation_options ?? [];
+
$returnArray['participationTypes'] = [];
diff --git a/database/migrations/2026_08_12_140010_add_participation_options_to_events.php b/database/migrations/2026_08_12_140010_add_participation_options_to_events.php
new file mode 100644
index 0000000..b07e30b
--- /dev/null
+++ b/database/migrations/2026_08_12_140010_add_participation_options_to_events.php
@@ -0,0 +1,23 @@
+json('participation_options')->nullable();
+ });
+ }
+
+ public function down(): void
+ {
+ Schema::table('events', function (Blueprint $table) {
+ $table->dropColumn('participation_options');
+ });
+ }
+};
diff --git a/database/migrations/2026_08_12_140020_create_event_participant_options.php b/database/migrations/2026_08_12_140020_create_event_participant_options.php
new file mode 100644
index 0000000..b16e2f7
--- /dev/null
+++ b/database/migrations/2026_08_12_140020_create_event_participant_options.php
@@ -0,0 +1,35 @@
+id();
+ $table->string('tenant');
+
+ $table->foreignId('event_id')->constrained('events', 'id')->cascadeOnDelete()->cascadeOnUpdate();
+ $table->foreignId('event_participant_id')->constrained('event_participants', 'id')->cascadeOnDelete()->cascadeOnUpdate();
+
+ $table->string('question_key');
+ $table->string('question_label');
+ $table->string('value');
+ $table->string('value_label');
+
+ $table->timestamps();
+
+ $table->foreign('tenant')->references('slug')->on('tenants')->restrictOnDelete()->cascadeOnUpdate();
+ });
+ }
+
+ public function down(): void
+ {
+ Schema::dropIfExists('event_participant_options');
+ }
+};
|