- Zahlungen erfassen (inkl. Erstattungen), Status automatisch: Bestätigt → Anzahlung erhalten → Bezahlt → Abgeschlossen - Anzahlungsfrist bei Bestätigung; kurzfristige Buchungen: Gesamtbetrag sofort - Mietvertrag als PDF (dompdf, Font-Subsetting), bei Bestätigung gespeichert und angehängt; Texte im Admin (Muster) - Täglich: Zahlungserinnerungen (Anzahlung/Rest überfällig, Kopie an Vermieter), Zahlungsaufforderung Rest 7 Tage vorher, Anreiseinfos 7 Tage vorher, Abschluss nach Abreise - Admin: Zahlungen je Buchung, offene Beträge, Vertrag herunterladen/neu erzeugen Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
1.0 KiB
PHP
35 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Documents;
|
|
|
|
use App\Models\Booking;
|
|
use Barryvdh\DomPDF\Facade\Pdf;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
/**
|
|
* The rental contract as PDF. It is generated once at confirmation and stored, so later changes
|
|
* of texts or prices do not alter a contract the guest already received.
|
|
*/
|
|
class RentalContract
|
|
{
|
|
private const DISK = 'local';
|
|
|
|
public function generate(Booking $booking): string
|
|
{
|
|
$booking->loadMissing(['guest', 'property']);
|
|
$path = "contracts/Mietvertrag-{$booking->reference}.pdf";
|
|
|
|
Storage::disk(self::DISK)->put($path, Pdf::loadView('pdf.contract', ['booking' => $booking])->setPaper('a4')->output());
|
|
$booking->update(['contract_path' => $path]);
|
|
|
|
return $path;
|
|
}
|
|
|
|
public function absolutePath(Booking $booking): ?string
|
|
{
|
|
return $booking->contract_path && Storage::disk(self::DISK)->exists($booking->contract_path)
|
|
? Storage::disk(self::DISK)->path($booking->contract_path)
|
|
: null;
|
|
}
|
|
}
|