Vollstaendige Gastdaten direkt im Zuordnungsdialog erfassen
Deploy FeWo mit PipelineManager / deploy (push) Successful in 2m48s

This commit is contained in:
Lars committed 2026-10-27 22:13:43 +01:00
1 parent 13f1b5856c
commit 78aafd7c28
6 files changed
+105 -28

No files matched your search

+9 -2
View File
@@ -13,7 +13,7 @@
class AssignOccupationGuest
{
/** @param array{first_name?: string, last_name?: ?string, email?: ?string, phone?: ?string} $details */
/** @param array{first_name?: string, last_name?: ?string, email?: ?string, phone?: ?string, street?: ?string, postal_code?: ?string, city?: ?string, country?: ?string, notes?: ?string, tags?: ?array} $details */
public function handle(Booking|BlockedPeriod $occupation, ?int $guestId, array $details = []): Guest
{
Gate::authorize('update', $occupation);
@@ -33,8 +33,15 @@ public function handle(Booking|BlockedPeriod $occupation, ?int $guestId, array $
'last_name' => ['nullable', 'string', 'max:255'],
'email' => ['nullable', 'email', 'max:255'],
'phone' => ['nullable', 'string', 'max:50'],
'street' => ['nullable', 'string', 'max:255'],
'postal_code' => ['nullable', 'string', 'max:20'],
'city' => ['nullable', 'string', 'max:255'],
'country' => ['nullable', 'string', 'size:2', 'regex:/^[A-Z]{2}$/'],
'notes' => ['nullable', 'string'],
'tags' => ['nullable', 'array'],
'tags.*' => ['string', 'max:255'],
])->validate();
$guest = new Guest([...$data, 'last_name' => $data['last_name'] ?? '', 'email' => filled($data['email'] ?? null) ? mb_strtolower(trim($data['email'])) : null]);
$guest = new Guest([...$data, 'last_name' => $data['last_name'] ?? '', 'email' => filled($data['email'] ?? null) ? mb_strtolower(trim($data['email'])) : null, 'country' => $data['country'] ?? 'DE']);
$guest->forceFill(['tenant_id' => $record->tenant_id])->save();
}
$record->forceFill(['guest_id' => $guest->id])->save();