Files
fewo-stommer/app/Models/BookingChange.php
T
LarsandClaude Opus 5.5 3bcfc09417
Deploy FeWo mit PipelineManager / deploy (push) Successful in 4m44s
Pakete 8, 5 und 6: Beträge und Zahlungen, Ändern und Stornieren, A6 im Vorgang
- Paket 8: Zahlungsarten (Gast an uns, laut Portal, Auszahlung, Erstattung),
  Portalbeträge als Angaben mit Quelle, Übersicht nach Zuständigkeit (R09).
- Paket 5: Ändern mit Folgenvorschau, vereinbart oder dem Gast vorgeschlagen
  (signierter Link), ein Stornoweg mit Grund und Erstattung, Portalstorno erst
  nach Bestätigung.
- Paket 6: eigene Nutzung, Besuch und Sperre als Vorgang mit Kurabgabe und
  Aufenthaltsbestätigung; Bestandsübernahme der Sperren mit identischem Export.
- Wirksame Einstellungen (Expertenansicht), Abnahmekatalog T01–T14, Ergebnis-,
  Abnahme- und Konfigurationsdokument.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 22:16:47 +01:00

57 lines
1.9 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Models;
use App\Enums\ChangeBasis;
use App\Enums\ChangeStatus;
use App\Models\Concerns\BelongsToTenant;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* One change of a booking (package 5): what it was before and after, who asked and why, from when, and on which basis
* the guest agreed – or, as long as it is only proposed, that the guest still has to agree.
*/
#[Fillable(['booking_id', 'status', 'requested_by', 'basis', 'reason', 'effective_on', 'agreed_at', 'agreed_by', 'before', 'after', 'consequences', 'expires_at', 'decided_at', 'decision_ip_hash', 'applied_at', 'confirmation_sent_at', 'recorded_by'])]
class BookingChange extends Model
{
use BelongsToTenant;
public const REQUESTERS = ['guest' => 'Der Gast', 'landlord' => 'Wir (Vermieter)', 'portal' => 'Das Portal'];
/**
* @return array<string, string>
*/
protected function casts(): array
{
return [
'status' => ChangeStatus::class,
'basis' => ChangeBasis::class,
'effective_on' => 'immutable_date',
'agreed_at' => 'immutable_datetime',
'before' => 'array',
'after' => 'array',
'consequences' => 'array',
'expires_at' => 'immutable_datetime',
'decided_at' => 'immutable_datetime',
'applied_at' => 'immutable_datetime',
'confirmation_sent_at' => 'immutable_datetime',
];
}
/** @return BelongsTo<Booking, $this> */
public function booking(): BelongsTo
{
return $this->belongsTo(Booking::class);
}
/**
* The change in one line, e.g. "07.11.–10.11.2026 → 07.11.–12.11.2026 · 2 → 3 Personen · 368,00 € → 450,00 €".
*/
public function summary(): string
{
return implode(' · ', (array) ($this->consequences['summary'] ?? []));
}
}