Event addons bookable
This commit is contained in:
@@ -89,11 +89,32 @@ class SignUpCommand {
|
||||
);
|
||||
|
||||
$this->persistParticipationOptions($response->participant, $participationOptionRows);
|
||||
$this->persistAddons($response->participant);
|
||||
|
||||
$response->success = true;
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Speichert die gewählten Zusätze (Event-Addons) als Snapshot-Zeilen (Titel/Preis/Betrag) für die spätere
|
||||
* Rechnung. Die Beträge sind bereits in der Controller-Auflösung (`resolveAddons`) berechnet, inkl. USt.
|
||||
*/
|
||||
private function persistAddons(\App\Models\EventParticipant $participant): void
|
||||
{
|
||||
foreach ($this->request->addonItems as $item) {
|
||||
$participant->selectedAddons()->create([
|
||||
'tenant' => $this->request->event->tenant,
|
||||
'event_id' => $this->request->event->id,
|
||||
'addon_key' => $item['key'],
|
||||
'title' => $item['title'],
|
||||
'price' => $item['price'] ?? 0,
|
||||
'flat' => (bool)($item['flat'] ?? false),
|
||||
'days' => $item['days'] ?? 0,
|
||||
'amount' => $item['amount'] ?? 0,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validiert die Antworten gegen die am Event definierten Teilnahmeoptionen und erzeugt die zu speichernden
|
||||
* Zeilen mit Label-Snapshots. Gibt null zurück, wenn eine Pflicht-Frage unbeantwortet oder eine Antwort
|
||||
|
||||
Reference in New Issue
Block a user