Booking path 1 (offer + guest acceptance), 2FA for all, privacy hardening, brand graphics in theme

- Offer workflow: "Angebot senden" in the admin (dates, guests, promo code, manual price adjustment,
  validity from the property's hold time, message, guest data for the contract) with live price;
  contract draft PDF; signed, versioned offer page for the guest to accept (acceptance record without
  IP) or decline; expiry job, landlord notifications, editable offer texts, wording on the website.
- 2FA is mandatory for every admin account.
- Privacy: complete anonymisation (notes, attribution, review names, offer messages), shorter
  periods for unbinding requests, portal mail excerpts and attribution (configurable proposals),
  iCal summary not stored, known e-mail no longer overwrites guest data, security headers, bearer
  tokens for automations, metadata stripped from photo originals, review link throttled.
- Daily database backup (backup:database) and scripts/backup-pull.sh for the NAS.
- Theme: brand mark in header/footer, favicon/touch icon, wave divider, icons, illustration as
  image placeholder; navy follows the text colour for dark appearances.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lars StommerandClaude Opus 5.5 committed 2026-10-22 21:38:22 +02:00
1 parent 82698f8eda
commit 4f69b426a4
77 files changed
+1658 -108

No files matched your search

+1 -1
View File
@@ -13,7 +13,7 @@ # Ferienwohnung Stommer
- Special offers are evaluated automatically by `PriceCalculator`; discounts are `QuoteLineType::Discount` lines with negative amounts. Kinds (`OfferKind`): rule, fixed dates, gap filler (`App\Availability\GapFinder`). Which offers the website advertises is decided by `App\Pricing\OfferShowcase` (not by appearances); it prices fixed dates/gaps with `PriceCalculator`.
- Portal sync lives in `app/Channels` (connector interface + registry in `config/channels.php`, iCal connector/parser/feed). Our system leads; `SyncChannel` imports portal occupations as `BlockedPeriod` rows with `channel_id`; each channel's export feed excludes its own blocks. Observers on Booking/BlockedPeriod create `ChannelTask`s for portals with `requires_manual_blocking`. Portal booking e-mails are a fast path (`app/Channels/Mail`, `ProcessPortalMail`): they create blocks with source `email`, which `SyncChannel` later confirms/replaces and never removes as stale. Portal analysis: `docs/PORTALE.md`.
- Website = theme system (`docs/THEMES.md`): themes live in `resources/themes/<key>` (theme.json, theme.css, theme.js, views); views resolve via the `theme::` namespace (theme → parent → base `ostsee-licht`). Pages are lists of sections (`app/Themes/Sections`, catalogue in `config/themes.php`); seasonal `Appearance`s override tokens/texts/hero photo/photos per section (stable `data.id` per placed section) and sections can be limited to appearances. Theme views use only token colour classes (`bg-accent`, `text-muted`, …). New designs are **additional** themes: `php artisan themes:make <key>`, `themes:check`, `themes:preview` – never edit `ostsee-licht` for a new design; authoring rules in `docs/THEME-ERSTELLUNG.md`. Resolve `Theme` lazily (`app(Theme::class)`), never in constructors – middleware `ResolveTheme` replaces it per request.
- Operations (environments, Strato access, server .env, admin accounts, 2FA, known pitfalls): `docs/BETRIEB.md` – read it before touching a server. Admin accounts: `php artisan users:create`; 2FA (Filament app authentication) is mandatory for admins via `RequireTwoFactorForAdmins`. Admin modes (`App\Enums\AdminMode`: simple/expert per user, user menu switch) only shape the menu via the `FollowsAdminMode` trait on every resource/page (simple menu = `AdminMode::SIMPLE_NAVIGATION`); permissions stay with roles/policies. New admin resources must use `FollowsAdminMode`.
- Operations (environments, Strato access, server .env, admin accounts, 2FA, known pitfalls): `docs/BETRIEB.md` – read it before touching a server. Admin accounts: `php artisan users:create`; 2FA (Filament app authentication) is mandatory for every account. Admin modes (`App\Enums\AdminMode`: simple/expert per user, user menu switch) only shape the menu via the `FollowsAdminMode` trait on every resource/page (simple menu = `AdminMode::SIMPLE_NAVIGATION`); permissions stay with roles/policies. New admin resources must use `FollowsAdminMode`.
- Deployment: `scripts/deploy.sh <env> setup|deploy [ref]|rollback|releases|artisan` (atomic releases on Strato, docs/DEPLOYMENT.md; the server keeps only the active release because of Strato's file quota – history = Git tags `deploy/<env>/<timestamp>`); CI `.gitea/workflows/deploy.yml`. Production has no dev packages (no factories/Faker) – production seeding via `ProductionSeeder`.
- Vite fonts plugin is removed on purpose (corporate proxy breaks remote font downloads, and fonts must be self-hosted for GDPR).
- PHP/Composer on this machine: winget package dir `%LOCALAPPDATA%\Microsoft\WinGet\Packages\PHP.PHP.8.4_*` (Composer as `composer\composer.phar` there).
+1 -1
View File
@@ -13,7 +13,7 @@ # Ferienwohnung Stommer
- Special offers are evaluated automatically by `PriceCalculator`; discounts are `QuoteLineType::Discount` lines with negative amounts. Kinds (`OfferKind`): rule, fixed dates, gap filler (`App\Availability\GapFinder`). Which offers the website advertises is decided by `App\Pricing\OfferShowcase` (not by appearances); it prices fixed dates/gaps with `PriceCalculator`.
- Portal sync lives in `app/Channels` (connector interface + registry in `config/channels.php`, iCal connector/parser/feed). Our system leads; `SyncChannel` imports portal occupations as `BlockedPeriod` rows with `channel_id`; each channel's export feed excludes its own blocks. Observers on Booking/BlockedPeriod create `ChannelTask`s for portals with `requires_manual_blocking`. Portal booking e-mails are a fast path (`app/Channels/Mail`, `ProcessPortalMail`): they create blocks with source `email`, which `SyncChannel` later confirms/replaces and never removes as stale. Portal analysis: `docs/PORTALE.md`.
- Website = theme system (`docs/THEMES.md`): themes live in `resources/themes/<key>` (theme.json, theme.css, theme.js, views); views resolve via the `theme::` namespace (theme → parent → base `ostsee-licht`). Pages are lists of sections (`app/Themes/Sections`, catalogue in `config/themes.php`); seasonal `Appearance`s override tokens/texts/hero photo/photos per section (stable `data.id` per placed section) and sections can be limited to appearances. Theme views use only token colour classes (`bg-accent`, `text-muted`, …). New designs are **additional** themes: `php artisan themes:make <key>`, `themes:check`, `themes:preview` – never edit `ostsee-licht` for a new design; authoring rules in `docs/THEME-ERSTELLUNG.md`. Resolve `Theme` lazily (`app(Theme::class)`), never in constructors – middleware `ResolveTheme` replaces it per request.
- Operations (environments, Strato access, server .env, admin accounts, 2FA, known pitfalls): `docs/BETRIEB.md` – read it before touching a server. Admin accounts: `php artisan users:create`; 2FA (Filament app authentication) is mandatory for admins via `RequireTwoFactorForAdmins`. Admin modes (`App\Enums\AdminMode`: simple/expert per user, user menu switch) only shape the menu via the `FollowsAdminMode` trait on every resource/page (simple menu = `AdminMode::SIMPLE_NAVIGATION`); permissions stay with roles/policies. New admin resources must use `FollowsAdminMode`.
- Operations (environments, Strato access, server .env, admin accounts, 2FA, known pitfalls): `docs/BETRIEB.md` – read it before touching a server. Admin accounts: `php artisan users:create`; 2FA (Filament app authentication) is mandatory for every account. Admin modes (`App\Enums\AdminMode`: simple/expert per user, user menu switch) only shape the menu via the `FollowsAdminMode` trait on every resource/page (simple menu = `AdminMode::SIMPLE_NAVIGATION`); permissions stay with roles/policies. New admin resources must use `FollowsAdminMode`.
- Deployment: `scripts/deploy.sh <env> setup|deploy [ref]|rollback|releases|artisan` (atomic releases on Strato, docs/DEPLOYMENT.md; the server keeps only the active release because of Strato's file quota – history = Git tags `deploy/<env>/<timestamp>`); CI `.gitea/workflows/deploy.yml`. Production has no dev packages (no factories/Faker) – production seeding via `ProductionSeeder`.
- Vite fonts plugin is removed on purpose (corporate proxy breaks remote font downloads, and fonts must be self-hosted for GDPR).
- PHP/Composer on this machine: winget package dir `%LOCALAPPDATA%\Microsoft\WinGet\Packages\PHP.PHP.8.4_*` (Composer as `composer\composer.phar` there).
+67
View File
@@ -0,0 +1,67 @@
<?php
namespace App\Actions;
use App\Enums\BookingStatus;
use App\Exceptions\ReservationException;
use App\Mail\OfferAnswered;
use App\Models\Booking;
use App\Support\Content;
use Illuminate\Support\Facades\Mail;
use Throwable;
/**
* The guest accepts the offer on the signed offer page: the booking is concluded. A record of what was
* accepted is kept (offer version, time, fingerprints of price and terms – no IP address), then the booking
* is confirmed as usual (contract + confirmation mail as electronic acknowledgement).
*/
class AcceptOffer
{
public function __construct(private ConfirmBooking $confirm) {}
/**
* @throws ReservationException
*/
public function handle(Booking $booking, int $offerVersion): void
{
$this->ensureAcceptable($booking, $offerVersion);
$booking->update([
'accepted_at' => now(),
'acceptance' => [
'offer_version' => $booking->offer_version,
'accepted_at' => now()->toIso8601String(),
'total' => $booking->total,
'quote_sha256' => hash('sha256', json_encode($booking->quote)),
'terms_sha256' => hash('sha256', (string) Content::get('contract.terms').'|'.Content::get('stay.cancellation')),
'via' => 'offer_link',
],
]);
$this->confirm->handle($booking);
try {
Mail::to(config('fewo.notification_email'))->send(new OfferAnswered($booking, accepted: true));
} catch (Throwable $exception) {
report($exception);
}
}
/**
* @throws ReservationException
*/
public function ensureAcceptable(Booking $booking, int $offerVersion): void
{
if ($offerVersion !== $booking->offer_version) {
throw ReservationException::offerOutdated();
}
if ($booking->status !== BookingStatus::OfferSent) {
throw ReservationException::invalidTransition($booking->status->getLabel(), 'angenommen');
}
if (! $booking->hold_expires_at?->isFuture()) {
throw ReservationException::offerExpired();
}
}
}
+32 -3
View File
@@ -2,10 +2,15 @@
namespace App\Actions;
use App\Models\Booking;
use App\Models\Guest;
use App\Models\PortalEmail;
/**
* Anonymises guests whose last stay ended longer ago than the retention period (GDPR storage limitation).
* GDPR storage limitation: anonymises guests whose last stay ended longer ago than the retention period, and
* guests who only ever sent requests/offers that never became binding (shorter period), and removes
* operational extras that are no longer needed (portal e-mail excerpts, marketing attribution).
* Booking records (dates, prices, payments) stay as accounting documents.
*/
class AnonymizeGuests
{
@@ -19,8 +24,32 @@ public function handle(): int
->whereDoesntHave('bookings', fn ($query) => $query->whereDate('departure', '>=', $cutoff))
->get();
$guests->each->anonymize();
$inquiryCutoff = now()->subMonths(config('fewo.retention.inquiry_months'));
$inquiriesOnly = Guest::query()
->whereNull('anonymized_at')
->whereDoesntHave('bookings', fn ($query) => $query->whereNotNull('confirmed_at'))
->whereDoesntHave('bookings', fn ($query) => $query->where('updated_at', '>=', $inquiryCutoff))
->where('updated_at', '<', $inquiryCutoff)
->get();
return $guests->count();
$all = $guests->merge($inquiriesOnly)->unique('id');
$all->each->anonymize();
$this->purgeOperationalData();
return $all->count();
}
private function purgeOperationalData(): void
{
PortalEmail::query()
->whereNotNull('excerpt')
->where('received_at', '<', now()->subDays(config('fewo.retention.portal_email_excerpt_days')))
->update(['excerpt' => null]);
Booking::query()
->where('created_at', '<', now()->subMonths(config('fewo.retention.attribution_months')))
->where(fn ($query) => $query->whereNotNull('referral_source')->orWhereNotNull('utm_source')->orWhereNotNull('utm_medium')->orWhereNotNull('utm_campaign'))
->update(['referral_source' => null, 'utm_source' => null, 'utm_medium' => null, 'utm_campaign' => null]);
}
}
+4 -4
View File
@@ -12,9 +12,9 @@
use Illuminate\Support\Facades\Mail;
/**
* The landlord accepts a reservation: the booking becomes binding, payment due dates are fixed,
* the rental contract is generated and sent with the confirmation.
* Expired reservations can still be confirmed while the dates are free.
* Makes a booking binding: payment due dates are fixed, the rental contract is generated and sent with the
* confirmation. Used when the guest accepts an offer (AcceptOffer) and when the landlord confirms directly
* (e.g. a booking agreed on the phone). Expired requests/offers can still be confirmed while the dates are free.
*/
class ConfirmBooking
{
@@ -28,7 +28,7 @@ public function __construct(
*/
public function handle(Booking $booking, bool $notifyGuest = true): void
{
if (! in_array($booking->status, [BookingStatus::Reserved, BookingStatus::Expired], true)) {
if (! in_array($booking->status, [BookingStatus::Reserved, BookingStatus::OfferSent, BookingStatus::Expired], true)) {
throw ReservationException::invalidTransition($booking->status->getLabel(), 'bestätigt');
}
+38 -2
View File
@@ -47,8 +47,7 @@ public function handle(Property $property, StayRequest $stay, array $guestData,
$quote = $this->calculator->calculate($property, $stay);
$guest = Guest::firstOrNew(['email' => mb_strtolower($guestData['email'])]);
$guest->fill($guestData)->fill(['email' => mb_strtolower($guestData['email'])])->save();
[$guest, $differences] = $this->guestFor($guestData);
return $property->bookings()->create([
'guest_id' => $guest->id,
@@ -66,6 +65,7 @@ public function handle(Property $property, StayRequest $stay, array $guestData,
'balance_due_on' => $quote->balanceDueOn->toDateString(),
'hold_expires_at' => now()->addHours($property->hold_hours),
'message' => $message,
'internal_notes' => $differences !== [] ? "Abweichende Angaben in dieser Anfrage (Gästekartei nicht geändert):\n".implode("\n", $differences) : null,
]);
});
@@ -76,6 +76,42 @@ public function handle(Property $property, StayRequest $stay, array $guestData,
return $booking;
}
/**
* The guest record for the request. A known e-mail address never overwrites existing master data
* (anybody can type somebody else's address); empty fields are completed, differing values are
* returned so the landlord sees them with the request and can take them over in the offer.
*
* @param array<string, ?string> $guestData
* @return array{0: Guest, 1: list<string>}
*/
private function guestFor(array $guestData): array
{
$email = mb_strtolower($guestData['email']);
$guest = Guest::query()->where('email', $email)->first();
if ($guest === null) {
return [Guest::create([...$guestData, 'email' => $email]), []];
}
$labels = ['first_name' => 'Vorname', 'last_name' => 'Nachname', 'phone' => 'Telefon', 'street' => 'Straße', 'postal_code' => 'PLZ', 'city' => 'Ort', 'country' => 'Land'];
$differences = [];
foreach ($labels as $field => $label) {
$value = trim((string) ($guestData[$field] ?? ''));
if ($value === '') {
continue;
}
if (blank($guest->{$field})) {
$guest->{$field} = $value;
} elseif (mb_strtolower((string) $guest->{$field}) !== mb_strtolower($value)) {
$differences[] = "{$label}: {$value} (Kartei: {$guest->{$field}})";
}
}
$guest->save();
return [$guest, $differences];
}
/**
* A failing mail server must not lose the reservation; failures are reported and visible in the log.
*/
+1 -1
View File
@@ -15,7 +15,7 @@ class DeclineBooking
*/
public function handle(Booking $booking, bool $notifyGuest = true): void
{
if (! in_array($booking->status, [BookingStatus::Reserved, BookingStatus::Expired], true)) {
if (! in_array($booking->status, [BookingStatus::Reserved, BookingStatus::OfferSent, BookingStatus::Expired], true)) {
throw ReservationException::invalidTransition($booking->status->getLabel(), 'abgelehnt');
}
+1 -1
View File
@@ -16,7 +16,7 @@ class ExpireReservations
public function handle(): int
{
$expired = Booking::query()
->where('status', BookingStatus::Reserved)
->whereIn('status', BookingStatus::holding())
->where('hold_expires_at', '<=', now())
->with(['guest', 'property'])
->get();
+42
View File
@@ -0,0 +1,42 @@
<?php
namespace App\Actions;
use App\Enums\BookingStatus;
use App\Exceptions\ReservationException;
use App\Mail\OfferAnswered;
use App\Models\Booking;
use Illuminate\Support\Facades\Mail;
use Throwable;
/**
* The guest declines the offer on the offer page: the dates are released and the landlord is informed.
*/
class RejectOffer
{
/**
* @throws ReservationException
*/
public function handle(Booking $booking, int $offerVersion): void
{
if ($offerVersion !== $booking->offer_version) {
throw ReservationException::offerOutdated();
}
if ($booking->status !== BookingStatus::OfferSent) {
throw ReservationException::invalidTransition($booking->status->getLabel(), 'abgelehnt');
}
$booking->update([
'status' => BookingStatus::Declined,
'declined_by' => 'guest',
'hold_expires_at' => null,
]);
try {
Mail::to(config('fewo.notification_email'))->send(new OfferAnswered($booking, accepted: false));
} catch (Throwable $exception) {
report($exception);
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?php
namespace App\Actions;
use App\Availability\AvailabilityChecker;
use App\Documents\RentalContract;
use App\Enums\BookingStatus;
use App\Enums\QuoteLineType;
use App\Exceptions\ReservationException;
use App\Mail\OfferMade;
use App\Models\Booking;
use App\Pricing\PriceCalculator;
use App\Pricing\PriceQuote;
use App\Pricing\QuoteException;
use App\Pricing\QuoteLine;
use App\Pricing\StayRequest;
use Carbon\CarbonImmutable;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\URL;
/**
* Booking path 1 (docs/KONZEPT.md §6a): the landlord turns a request into an offer. Dates, guests, promo
* code, a manual price adjustment and the guest's contact data can be changed; the price is calculated again,
* the contract draft is generated and the guest receives it with a signed link to accept or decline.
* Sending again replaces the previous offer (links of older versions stop working).
*/
class SendOffer
{
public function __construct(
private PriceCalculator $calculator,
private AvailabilityChecker $availability,
private RentalContract $contract,
) {}
/**
* @param array{arrival?: string, departure?: string, guests?: int, promo_code?: ?string, price_adjustment?: ?int, price_adjustment_label?: ?string, valid_until?: ?string, offer_message?: ?string, guest?: array<string, ?string>} $changes
*
* @throws QuoteException
* @throws ReservationException
*/
public function handle(Booking $booking, array $changes = [], bool $sendMail = true): Booking
{
if (! in_array($booking->status, [BookingStatus::Reserved, BookingStatus::OfferSent, BookingStatus::Expired], true)) {
throw ReservationException::invalidTransition($booking->status->getLabel(), 'als Angebot versendet');
}
DB::transaction(function () use ($booking, $changes): void {
$arrival = CarbonImmutable::parse($changes['arrival'] ?? $booking->arrival);
$departure = CarbonImmutable::parse($changes['departure'] ?? $booking->departure);
if (! $this->availability->isAvailable($booking->property, $arrival, $departure, ignore: $booking)) {
throw ReservationException::notAvailable();
}
$promoCode = array_key_exists('promo_code', $changes) ? (filled($changes['promo_code']) ? trim((string) $changes['promo_code']) : null) : $booking->promo_code;
$stay = new StayRequest($arrival, $departure, (int) ($changes['guests'] ?? $booking->guests), $booking->extras ?? [], $promoCode);
$adjustment = (int) ($changes['price_adjustment'] ?? 0);
$adjustmentLabel = trim((string) ($changes['price_adjustment_label'] ?? '')) ?: ($adjustment < 0 ? 'Nachlass' : 'Zuschlag');
$quote = $this->quoteWithAdjustment($booking, $stay, $adjustment, $adjustmentLabel);
if (filled($changes['guest'] ?? null)) {
$booking->guest->update(Arr::only(array_map(fn ($value) => filled($value) ? trim((string) $value) : null, $changes['guest']), ['first_name', 'last_name', 'phone', 'street', 'postal_code', 'city', 'country']));
}
$booking->update([
'status' => BookingStatus::OfferSent,
'arrival' => $arrival->toDateString(),
'departure' => $departure->toDateString(),
'guests' => $stay->guests,
'promo_code' => $quote->promoCodeApplied ? $promoCode : null,
'price_adjustment' => $adjustment !== 0 ? $adjustment : null,
'price_adjustment_label' => $adjustment !== 0 ? $adjustmentLabel : null,
'quote' => $quote->toArray(),
'total' => $quote->total(),
'deposit' => $quote->deposit(),
'balance_due_on' => $quote->balanceDueOn->toDateString(),
'hold_expires_at' => filled($changes['valid_until'] ?? null) ? CarbonImmutable::parse($changes['valid_until']) : now()->addHours($booking->property->hold_hours),
'offer_version' => $booking->offer_version + 1,
'offer_sent_at' => now(),
'offer_message' => $changes['offer_message'] ?? null,
]);
});
$booking->refresh();
$this->contract->generate($booking, draft: true);
if ($sendMail) {
Mail::to($booking->guest->email, $booking->guest->full_name)->send(new OfferMade($booking, $this->offerUrl($booking)));
}
return $booking;
}
/**
* The guest's link to the offer page; valid while the offer is valid and only for this offer version.
*/
public function offerUrl(Booking $booking): string
{
return URL::temporarySignedRoute('offers.show', $booking->hold_expires_at, ['booking' => $booking, 'v' => $booking->offer_version]);
}
/**
* Price for the (possibly changed) stay plus the manual adjustment; a reduction never makes the stay negative.
*
* @throws QuoteException
*/
private function quoteWithAdjustment(Booking $booking, StayRequest $stay, int $adjustment, string $label): PriceQuote
{
$quote = $this->calculator->calculate($booking->property, $stay);
if ($adjustment === 0) {
return $quote;
}
$adjustment = max($adjustment, -$quote->rent());
return $quote->withLine(new QuoteLine(QuoteLineType::Adjustment, $label, 1, $adjustment, $adjustment));
}
}
+2 -1
View File
@@ -64,7 +64,8 @@ public function handle(Channel $channel): ChannelSyncLog
'property_id' => $channel->property_id,
'starts_on' => $period->startsOn->toDateString(),
'ends_on' => $period->endsOn->toDateString(),
'reason' => "{$channel->name}".($period->summary ? ": {$period->summary}" : ''),
// The portal's SUMMARY is not stored: it may contain guest names (data minimisation).
'reason' => $channel->name,
'source' => 'channel',
];
+117
View File
@@ -0,0 +1,117 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
use Throwable;
#[Signature('backup:database {--keep= : Anzahl aufbewahrter Sicherungen}')]
#[Description('Write a compressed SQL dump of the database to storage/app/private/backups and keep the newest ones')]
class BackupDatabase extends Command
{
public const DIRECTORY = 'backups';
/** Tables without lasting value; their content is not dumped (structure only). */
private const SKIP_DATA = ['sessions', 'cache', 'cache_locks', 'jobs', 'job_batches', 'failed_jobs'];
/**
* Execute the console command.
*/
public function handle(): int
{
$keep = (int) ($this->option('keep') ?? config('fewo.backup.keep', 14));
$file = self::DIRECTORY.'/fewo-'.now()->format('Ymd-His').'.sql.gz';
$temp = tempnam(sys_get_temp_dir(), 'fewo-backup');
$out = gzopen($temp, 'wb6');
try {
gzwrite($out, '-- FeWo Stommer database backup '.now()->toIso8601String().' ('.DB::getDriverName().")\n");
gzwrite($out, $this->isMysql() ? "SET FOREIGN_KEY_CHECKS=0;\nSET NAMES utf8mb4;\n" : "PRAGMA foreign_keys=OFF;\n");
foreach ($this->tables() as $table) {
gzwrite($out, "\nDROP TABLE IF EXISTS ".$this->quoteName($table).";\n".$this->createStatement($table).";\n");
if (! in_array($table, self::SKIP_DATA, true)) {
$this->dumpRows($out, $table);
}
}
gzwrite($out, $this->isMysql() ? "SET FOREIGN_KEY_CHECKS=1;\n" : "PRAGMA foreign_keys=ON;\n");
gzclose($out);
Storage::disk('local')->put($file, (string) file_get_contents($temp));
} catch (Throwable $exception) {
report($exception);
$this->error('Sicherung fehlgeschlagen: '.$exception->getMessage());
return self::FAILURE;
} finally {
@unlink($temp);
}
$this->prune($keep);
$this->info("Sicherung erstellt: storage/app/private/{$file} (".round(Storage::disk('local')->size($file) / 1024).' KB)');
return self::SUCCESS;
}
private function isMysql(): bool
{
return in_array(DB::getDriverName(), ['mysql', 'mariadb'], true);
}
/**
* @return list<string>
*/
private function tables(): array
{
return $this->isMysql()
? array_map(fn (object $row): string => (string) array_values((array) $row)[0], DB::select('SHOW TABLES'))
: array_map(fn (object $row): string => $row->name, DB::select("SELECT name FROM sqlite_master WHERE type = 'table' AND name NOT LIKE 'sqlite_%' ORDER BY name"));
}
private function createStatement(string $table): string
{
if ($this->isMysql()) {
return (string) array_values((array) DB::selectOne('SHOW CREATE TABLE '.$this->quoteName($table)))[1];
}
return (string) DB::selectOne("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = ?", [$table])->sql;
}
/**
* @param resource $out
*/
private function dumpRows($out, string $table): void
{
$pdo = DB::connection()->getPdo();
$offset = 0;
do {
$rows = DB::table($table)->offset($offset)->limit(500)->get();
foreach ($rows as $row) {
$values = array_map(fn ($value): string => $value === null ? 'NULL' : (is_int($value) || is_float($value) ? (string) $value : $pdo->quote((string) $value)), (array) $row);
gzwrite($out, 'INSERT INTO '.$this->quoteName($table).' ('.implode(', ', array_map($this->quoteName(...), array_keys((array) $row))).') VALUES ('.implode(', ', $values).");\n");
}
$offset += 500;
} while ($rows->count() === 500);
}
private function quoteName(string $name): string
{
return $this->isMysql() ? '`'.str_replace('`', '``', $name).'`' : '"'.str_replace('"', '""', $name).'"';
}
private function prune(int $keep): void
{
collect(Storage::disk('local')->files(self::DIRECTORY))
->filter(fn (string $path): bool => str_ends_with($path, '.sql.gz'))
->sort()
->reverse()
->slice(max(1, $keep))
->each(fn (string $path) => Storage::disk('local')->delete($path));
}
}
+1 -3
View File
@@ -55,9 +55,7 @@ public function handle(): int
$this->info("Benutzer {$email} ({$role->getLabel()}) angelegt.");
if ($role === UserRole::Admin) {
$this->line('Bei der ersten Anmeldung wird die Zwei-Faktor-Anmeldung mit einer Authenticator-App eingerichtet.');
}
$this->line('Bei der ersten Anmeldung wird die Zwei-Faktor-Anmeldung mit einer Authenticator-App eingerichtet.');
return self::SUCCESS;
}
@@ -0,0 +1,29 @@
<?php
namespace App\Console\Commands;
use App\Models\Photo;
use App\Support\StripImageMetadata;
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
use Spatie\MediaLibrary\MediaCollections\Models\Media;
#[Signature('photos:strip-metadata')]
#[Description('Remove metadata (GPS position, camera data) from all stored original photos – new uploads are cleaned automatically')]
class StripPhotoMetadata extends Command
{
/**
* Execute the console command.
*/
public function handle(): int
{
$cleaned = Media::query()->where('collection_name', Photo::COLLECTION)->get()
->filter(fn (Media $media): bool => StripImageMetadata::strip($media))
->count();
$this->info("{$cleaned} Original-Foto(s) bereinigt.");
return self::SUCCESS;
}
}
+13 -10
View File
@@ -7,28 +7,31 @@
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.
* The rental contract as PDF. As a draft it is part of the offer (offer_path, one file per offer version);
* the final contract is generated at confirmation (contract_path). Both are stored, so later changes of
* texts or prices do not alter a document the guest already received.
*/
class RentalContract
{
private const DISK = 'local';
public function generate(Booking $booking): string
public function generate(Booking $booking, bool $draft = false): string
{
$booking->loadMissing(['guest', 'property']);
$path = "contracts/Mietvertrag-{$booking->reference}.pdf";
$path = $draft
? "contracts/Angebot-{$booking->reference}-v{$booking->offer_version}.pdf"
: "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]);
Storage::disk(self::DISK)->put($path, Pdf::loadView('pdf.contract', ['booking' => $booking, 'draft' => $draft])->setPaper('a4')->output());
$booking->update([$draft ? 'offer_path' : 'contract_path' => $path]);
return $path;
}
public function absolutePath(Booking $booking): ?string
public function absolutePath(Booking $booking, bool $draft = false): ?string
{
return $booking->contract_path && Storage::disk(self::DISK)->exists($booking->contract_path)
? Storage::disk(self::DISK)->path($booking->contract_path)
: null;
$path = $draft ? $booking->offer_path : $booking->contract_path;
return $path && Storage::disk(self::DISK)->exists($path) ? Storage::disk(self::DISK)->path($path) : null;
}
}
+19 -2
View File
@@ -7,8 +7,13 @@
enum BookingStatus: string implements HasColor, HasLabel
{
/** Guest request; the dates are held until hold_expires_at. */
/** Non-binding guest request; the dates are held until hold_expires_at. */
case Reserved = 'reserved';
/** The landlord sent an offer; the dates are held until hold_expires_at (= end of the offer's validity). */
case OfferSent = 'offer_sent';
/** Binding booking: the guest accepted the offer (or the landlord confirmed directly). */
case Confirmed = 'confirmed';
case DepositPaid = 'deposit_paid';
case Paid = 'paid';
@@ -20,7 +25,8 @@ enum BookingStatus: string implements HasColor, HasLabel
public function getLabel(): string
{
return match ($this) {
self::Reserved => 'Vorreserviert',
self::Reserved => 'Anfrage (vorgemerkt)',
self::OfferSent => 'Angebot gesendet',
self::Confirmed => 'Bestätigt',
self::DepositPaid => 'Anzahlung erhalten',
self::Paid => 'Bezahlt',
@@ -35,12 +41,23 @@ public function getColor(): string
{
return match ($this) {
self::Reserved => 'warning',
self::OfferSent => 'primary',
self::Confirmed, self::DepositPaid => 'info',
self::Paid, self::Completed => 'success',
self::Declined, self::Expired, self::Cancelled => 'gray',
};
}
/**
* Statuses that occupy the calendar while their hold time (hold_expires_at) runs.
*
* @return list<self>
*/
public static function holding(): array
{
return [self::Reserved, self::OfferSent];
}
/**
* Statuses that occupy the calendar regardless of any hold time.
*
+4 -1
View File
@@ -10,11 +10,14 @@ enum QuoteLineType: string
case Extra = 'extra';
case Discount = 'discount';
/** Manual price change by the landlord in an offer (negative = reduction). */
case Adjustment = 'adjustment';
/**
* Whether the line counts towards the rent on which the deposit is calculated.
*/
public function isRent(): bool
{
return in_array($this, [self::Accommodation, self::ExtraGuest, self::Discount], true);
return in_array($this, [self::Accommodation, self::ExtraGuest, self::Discount, self::Adjustment], true);
}
}
+10
View File
@@ -14,6 +14,16 @@ public static function notAvailable(): self
return new self('Der gewünschte Zeitraum ist leider nicht mehr frei.');
}
public static function offerExpired(): self
{
return new self('Dieses Angebot ist nicht mehr gültig. Bitte melden Sie sich bei uns – gern erstellen wir Ihnen ein neues Angebot.');
}
public static function offerOutdated(): self
{
return new self('Zu dieser Anfrage gibt es inzwischen ein aktualisiertes Angebot. Bitte verwenden Sie den Link aus unserer neuesten E-Mail.');
}
public static function invalidTransition(string $statusLabel, string $action): self
{
return new self("Eine Buchung im Status „{$statusLabel}“ kann nicht {$action} werden.");
@@ -4,19 +4,31 @@
use App\Actions\ConfirmBooking;
use App\Actions\DeclineBooking;
use App\Actions\SendOffer;
use App\Documents\RentalContract;
use App\Enums\BookingStatus;
use App\Exceptions\ReservationException;
use App\Filament\Resources\Bookings\BookingResource;
use App\Models\Booking;
use App\Pricing\PriceCalculator;
use App\Pricing\QuoteException;
use App\Pricing\StayRequest;
use App\Support\Money;
use Carbon\CarbonImmutable;
use Filament\Actions\Action;
use Filament\Actions\ActionGroup;
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\ViewRecord;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Text;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Support\Icons\Heroicon;
use Throwable;
/**
* @property Booking $record
@@ -33,14 +45,80 @@ public function getTitle(): string
protected function getHeaderActions(): array
{
return [
Action::make('confirm')
->label('Bestätigen')
->icon(Heroicon::OutlinedCheckCircle)
Action::make('sendOffer')
->label(fn (): string => $this->record->status === BookingStatus::OfferSent ? 'Angebot ändern & neu senden' : 'Angebot senden')
->icon(Heroicon::OutlinedPaperAirplane)
->color('success')
->visible(fn (): bool => in_array($this->record->status, [BookingStatus::Reserved, BookingStatus::Expired], true))
->visible(fn (): bool => in_array($this->record->status, [BookingStatus::Reserved, BookingStatus::OfferSent, BookingStatus::Expired], true))
->modalHeading('Angebot an den Gast senden')
->modalDescription('Der Gast erhält das Angebot mit Vertragsentwurf per E-Mail und kann es über einen Link annehmen oder ablehnen. Erst mit seiner Annahme ist die Buchung verbindlich.')
->modalSubmitActionLabel('Angebot senden')
->modalWidth('3xl')
->fillForm(fn (): array => [
'arrival' => $this->record->arrival->toDateString(),
'departure' => $this->record->departure->toDateString(),
'guests' => $this->record->guests,
'promo_code' => $this->record->promo_code,
'price_adjustment' => $this->record->price_adjustment !== null ? number_format($this->record->price_adjustment / 100, 2, '.', '') : null,
'price_adjustment_label' => $this->record->price_adjustment_label,
'valid_until' => now()->addHours($this->record->property->hold_hours)->format('Y-m-d H:i'),
'offer_message' => $this->record->offer_message,
'guest' => $this->record->guest->only(['first_name', 'last_name', 'street', 'postal_code', 'city', 'phone']),
])
->schema([
Section::make('Termin')->columns(3)->schema([
DatePicker::make('arrival')->label('Anreise')->required()->live(onBlur: true),
DatePicker::make('departure')->label('Abreise')->after('arrival')->required()->live(onBlur: true),
TextInput::make('guests')->label('Personen')->integer()->minValue(1)->maxValue(fn (): int => $this->record->property->max_guests)->required()->live(onBlur: true),
]),
Section::make('Preis')->columns(3)->schema([
TextInput::make('promo_code')->label('Rabattcode')->helperText('Sonderkondition aus den Angeboten')->maxLength(50)->live(onBlur: true),
TextInput::make('price_adjustment')
->label('Preisanpassung')
->helperText('Minus = Nachlass, z. B. -50')
->numeric()
->step(0.01)
->suffix('€')
->live(onBlur: true),
TextInput::make('price_adjustment_label')->label('Bezeichnung')->placeholder('Nachlass / Zuschlag')->maxLength(80),
Text::make(fn (Get $get): string => $this->offerPricePreview($get))->columnSpanFull(),
]),
Section::make('Gültigkeit & Nachricht')->columns(2)->schema([
DateTimePicker::make('valid_until')
->label('Angebot gültig bis')
->helperText(fn (): string => 'Standard: '.$this->record->property->hold_hours.' Stunden (Einstellung der Wohnung). Bis dahin bleibt der Zeitraum reserviert.')
->seconds(false)
->after('now')
->required(),
Textarea::make('offer_message')->label('Persönliche Nachricht an den Gast (optional)')->rows(3),
]),
Section::make('Gast – so erscheint er im Mietvertrag')->columns(2)->collapsed()->schema([
TextInput::make('guest.first_name')->label('Vorname')->required()->maxLength(100),
TextInput::make('guest.last_name')->label('Nachname')->required()->maxLength(100),
TextInput::make('guest.street')->label('Straße und Hausnummer')->maxLength(150),
TextInput::make('guest.postal_code')->label('PLZ')->maxLength(20),
TextInput::make('guest.city')->label('Ort')->maxLength(100),
TextInput::make('guest.phone')->label('Telefon')->maxLength(50),
]),
])
->action(fn (array $data, SendOffer $send) => $this->runWorkflow(
fn () => $send->handle($this->record, $this->offerChanges($data)),
'Angebot gesendet',
)),
Action::make('offerPdf')
->label('Angebot (PDF)')
->icon(Heroicon::OutlinedDocumentText)
->color('gray')
->visible(fn (): bool => $this->record->status === BookingStatus::OfferSent && $this->record->offer_path !== null)
->action(fn (RentalContract $contract) => response()->download($contract->absolutePath($this->record, draft: true) ?? abort(404), "Angebot-{$this->record->reference}.pdf")),
Action::make('confirm')
->label('Direkt bestätigen')
->icon(Heroicon::OutlinedCheckCircle)
->color('gray')
->visible(fn (): bool => in_array($this->record->status, [BookingStatus::Reserved, BookingStatus::OfferSent, BookingStatus::Expired], true))
->requiresConfirmation()
->modalHeading('Buchung bestätigen')
->modalDescription('Die Buchung wird verbindlich und der Zeitraum dauerhaft belegt.')
->modalHeading('Buchung direkt bestätigen')
->modalDescription('Ohne Angebot und Annahme durch den Gast – nur wenn die Buchung bereits anders verbindlich vereinbart wurde (z. B. telefonisch). Die Buchung wird verbindlich und der Zeitraum dauerhaft belegt.')
->schema([
Toggle::make('notify')->label('Buchungsbestätigung an den Gast senden')->default(true),
])
@@ -52,7 +130,7 @@ protected function getHeaderActions(): array
->label('Ablehnen')
->icon(Heroicon::OutlinedXCircle)
->color('danger')
->visible(fn (): bool => in_array($this->record->status, [BookingStatus::Reserved, BookingStatus::Expired], true))
->visible(fn (): bool => in_array($this->record->status, [BookingStatus::Reserved, BookingStatus::OfferSent, BookingStatus::Expired], true))
->requiresConfirmation()
->modalHeading('Anfrage ablehnen')
->schema([
@@ -66,7 +144,7 @@ protected function getHeaderActions(): array
->label('Vormerkung verlängern')
->icon(Heroicon::OutlinedClock)
->color('gray')
->visible(fn (): bool => $this->record->status === BookingStatus::Reserved)
->visible(fn (): bool => in_array($this->record->status, BookingStatus::holding(), true))
->schema([
TextInput::make('hours')->label('Um')->integer()->minValue(1)->default(24)->suffix('Stunden')->required(),
])
@@ -117,11 +195,45 @@ protected function getHeaderActions(): array
];
}
/**
* Form data of the offer modal as SendOffer changes (euro input → cents).
*
* @param array<string, mixed> $data
* @return array<string, mixed>
*/
private function offerChanges(array $data): array
{
return [
...$data,
'price_adjustment' => filled($data['price_adjustment'] ?? null) ? (int) round((float) $data['price_adjustment'] * 100) : null,
];
}
/**
* Live price shown in the offer modal, calculated exactly like the offer itself.
*/
private function offerPricePreview(Get $get): string
{
try {
$stay = new StayRequest(CarbonImmutable::parse($get('arrival')), CarbonImmutable::parse($get('departure')), (int) $get('guests'), $this->record->extras ?? [], filled($get('promo_code')) ? (string) $get('promo_code') : null);
$quote = app(PriceCalculator::class)->calculate($this->record->property, $stay);
} catch (QuoteException $exception) {
return 'Preis: '.$exception->getMessage();
} catch (Throwable) {
return 'Preis: bitte Termin und Personen angeben.';
}
$adjustment = filled($get('price_adjustment')) ? max((int) round((float) $get('price_adjustment') * 100), -$quote->rent()) : 0;
$promo = filled($get('promo_code')) ? ($quote->promoCodeApplied ? ' · Rabattcode angewendet' : ' · Rabattcode gilt hier nicht') : '';
return 'Gesamtpreis im Angebot: '.Money::format($quote->total() + $adjustment).' (bisher '.Money::format($this->record->total).')'.$promo;
}
private function runWorkflow(callable $workflow, string $successTitle): void
{
try {
$workflow();
} catch (ReservationException $exception) {
} catch (ReservationException|QuoteException $exception) {
Notification::make()->title('Nicht möglich')->body($exception->getMessage())->danger()->send();
return;
+13 -4
View File
@@ -36,8 +36,7 @@ public function feed(string $token, ICalFeed $feed): Response
public function health(Request $request): JsonResponse
{
$token = config('fewo.channels.health_token');
abort_if(blank($token) || ! hash_equals($token, (string) $request->query('token')), 404);
abort_unless($this->hasValidToken($request, config('fewo.channels.health_token')), 404);
$channels = Channel::query()->active()->get()->map(fn (Channel $channel): array => [
'name' => $channel->name,
@@ -69,8 +68,7 @@ public function health(Request $request): JsonResponse
*/
public function scheduler(Request $request): JsonResponse
{
$token = config('fewo.scheduler_token');
abort_if(blank($token) || ! hash_equals($token, (string) $request->query('token')), 404);
abort_unless($this->hasValidToken($request, config('fewo.scheduler_token')), 404);
Artisan::call('schedule:run');
@@ -129,4 +127,15 @@ private function verifySignature(Request $request): void
abort_if(blank($secret) || ! hash_equals(hash_hmac('sha256', $request->getContent(), $secret), $signature), 403);
}
/**
* The token is sent as header "Authorization: Bearer <token>" (preferred – does not end up in web server logs)
* or, for older automations, as ?token=<token>.
*/
private function hasValidToken(Request $request, ?string $expected): bool
{
$given = (string) ($request->bearerToken() ?? $request->header('X-Fewo-Token') ?? $request->query('token', ''));
return filled($expected) && hash_equals((string) $expected, $given);
}
}
+75
View File
@@ -0,0 +1,75 @@
<?php
namespace App\Http\Controllers;
use App\Actions\AcceptOffer;
use App\Actions\RejectOffer;
use App\Enums\BookingStatus;
use App\Exceptions\ReservationException;
use App\Models\Booking;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\URL;
/**
* The guest's offer page (no account): reached by the signed link in the offer e-mail. Shows the complete
* offer and lets the guest accept or decline it; the form actions are signed the same way.
*/
class OfferController extends Controller
{
public function show(Request $request, Booking $booking, AcceptOffer $accept): View
{
$booking->loadMissing(['guest', 'property']);
$version = (int) $request->query('v');
$problem = null;
if ($booking->status === BookingStatus::OfferSent) {
try {
$accept->ensureAcceptable($booking, $version);
} catch (ReservationException $exception) {
$problem = $exception->getMessage();
}
}
$expires = $booking->hold_expires_at?->isFuture() ? $booking->hold_expires_at : now()->addHour();
return view('offer', [
'booking' => $booking,
'problem' => $problem,
'canAnswer' => $booking->status === BookingStatus::OfferSent && $problem === null,
'acceptUrl' => URL::temporarySignedRoute('offers.accept', $expires, ['booking' => $booking, 'v' => $version]),
'rejectUrl' => URL::temporarySignedRoute('offers.reject', $expires, ['booking' => $booking, 'v' => $version]),
'title' => 'Ihr Angebot',
]);
}
public function accept(Request $request, Booking $booking, AcceptOffer $accept): RedirectResponse
{
$request->validate(['terms' => ['accepted']], ['terms.accepted' => 'Bitte bestätigen Sie, dass Sie die Bedingungen gelesen haben.']);
return $this->answer($request, $booking, fn (int $version) => $accept->handle($booking, $version), 'Vielen Dank! Ihre Buchung ist verbindlich. Die Bestätigung mit dem Mietvertrag haben wir Ihnen per E-Mail gesendet.');
}
public function reject(Request $request, Booking $booking, RejectOffer $reject): RedirectResponse
{
return $this->answer($request, $booking, fn (int $version) => $reject->handle($booking, $version), 'Schade – wir haben Ihre Absage erhalten und den Zeitraum wieder freigegeben. Vielleicht ein anderes Mal!');
}
/**
* Runs the answer and returns to a freshly signed offer page with the result.
*/
private function answer(Request $request, Booking $booking, callable $action, string $success): RedirectResponse
{
$version = (int) $request->query('v');
$back = URL::temporarySignedRoute('offers.show', now()->addDays(30), ['booking' => $booking, 'v' => $version]);
try {
$action($version);
} catch (ReservationException $exception) {
return redirect()->to($back)->with('offer.error', $exception->getMessage());
}
return redirect()->to($back)->with('offer.success', $success);
}
}
+1
View File
@@ -66,6 +66,7 @@ public function robots(): Response
'Disallow: /automation',
'Disallow: /bewertung',
'Disallow: /angebote',
'Disallow: /angebot/',
'Sitemap: '.route('sitemap'),
'',
]), 200, ['Content-Type' => 'text/plain; charset=UTF-8']);
@@ -1,28 +0,0 @@
<?php
namespace App\Http\Middleware;
use App\Enums\UserRole;
use App\Models\User;
use Closure;
use Filament\Auth\MultiFactor\Http\Middleware\EnsureMultiFactorAuthenticationIsEnabled;
use Filament\Facades\Filament;
use Illuminate\Http\Request;
/**
* Filament evaluates "two-factor required" once per panel; this narrows it to administrators.
* Other roles may set it up voluntarily in their profile.
*/
class RequireTwoFactorForAdmins extends EnsureMultiFactorAuthenticationIsEnabled
{
public function handle(Request $request, Closure $next): mixed
{
$user = Filament::auth()->user();
if (! $user instanceof User || ! $user->hasRole(UserRole::Admin)) {
return $next($request);
}
return parent::handle($request, $next);
}
}
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
/**
* Security headers for every response. A Content-Security-Policy is not set yet: Livewire/Filament rely on
* inline scripts and styles, a policy needs nonces and a careful test first.
*/
class SecurityHeaders
{
public function handle(Request $request, Closure $next): Response
{
$response = $next($request);
$response->headers->set('X-Content-Type-Options', 'nosniff');
$response->headers->set('X-Frame-Options', 'SAMEORIGIN');
$response->headers->set('Referrer-Policy', 'strict-origin-when-cross-origin');
$response->headers->set('Permissions-Policy', 'camera=(), microphone=(), geolocation=(), payment=(), usb=()');
if ($request->isSecure() && ! app()->environment('local', 'testing')) {
$response->headers->set('Strict-Transport-Security', 'max-age=31536000');
}
return $response;
}
}
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace App\Mail;
use App\Models\Booking;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
/**
* Tells the landlord that the guest accepted or declined an offer.
*/
class OfferAnswered extends Mailable
{
use Queueable, SerializesModels;
public function __construct(public Booking $booking, public bool $accepted) {}
public function envelope(): Envelope
{
return new Envelope(
subject: ($this->accepted ? 'Angebot angenommen: ' : 'Angebot abgelehnt: ').$this->booking->reference,
);
}
public function content(): Content
{
return new Content(markdown: 'mail.offer-answered');
}
}
+46
View File
@@ -0,0 +1,46 @@
<?php
namespace App\Mail;
use App\Documents\RentalContract;
use App\Models\Booking;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Attachment;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
/**
* The offer to the guest: price, validity, contract draft as PDF and the link to accept or decline.
*/
class OfferMade extends Mailable
{
use Queueable, SerializesModels;
public function __construct(public Booking $booking, public string $offerUrl) {}
public function envelope(): Envelope
{
return new Envelope(
subject: 'Ihr Angebot '.$this->booking->reference.' – Ferienwohnung Stommer',
replyTo: [new Address(config('fewo.owner.email'), config('fewo.owner.name'))],
);
}
public function content(): Content
{
return new Content(markdown: 'mail.offer-made');
}
/**
* @return list<Attachment>
*/
public function attachments(): array
{
$path = app(RentalContract::class)->absolutePath($this->booking, draft: true);
return $path ? [Attachment::fromPath($path)->as("Angebot-{$this->booking->reference}.pdf")->withMime('application/pdf')] : [];
}
}
+1 -1
View File
@@ -22,7 +22,7 @@ public function __construct(public Booking $booking) {}
public function envelope(): Envelope
{
return new Envelope(
subject: 'Ihre Anfrage '.$this->booking->reference.' – Termin vorgemerkt',
subject: 'Ihre Anfrage '.$this->booking->reference.' – Termin vorgemerkt, Angebot folgt',
replyTo: [new Address(config('fewo.owner.email'), config('fewo.owner.name'))],
);
}
+15 -3
View File
@@ -36,6 +36,8 @@
'guests',
'extras',
'promo_code',
'price_adjustment',
'price_adjustment_label',
'quote',
'total',
'deposit',
@@ -43,9 +45,16 @@
'balance_due_on',
'contract_path',
'hold_expires_at',
'offer_version',
'offer_sent_at',
'offer_message',
'offer_path',
'message',
'internal_notes',
'confirmed_at',
'accepted_at',
'acceptance',
'declined_by',
'cancelled_at',
'review_requested_at',
'deposit_reminded_at',
@@ -83,6 +92,9 @@ protected function casts(): array
'balance_due_on' => 'immutable_date',
'hold_expires_at' => 'immutable_datetime',
'confirmed_at' => 'immutable_datetime',
'offer_sent_at' => 'immutable_datetime',
'accepted_at' => 'immutable_datetime',
'acceptance' => 'array',
'cancelled_at' => 'immutable_datetime',
'review_requested_at' => 'immutable_datetime',
'deposit_reminded_at' => 'immutable_datetime',
@@ -109,7 +121,7 @@ public function guest(): BelongsTo
}
/**
* Bookings that currently occupy their dates: confirmed ones and reservations whose hold has not expired.
* Bookings that currently occupy their dates: confirmed ones and requests/offers whose hold has not expired.
*
* @param Builder<Booking> $query
* @return Builder<Booking>
@@ -120,7 +132,7 @@ protected function occupying(Builder $query): Builder
return $query->where(fn (Builder $query) => $query
->whereIn('status', BookingStatus::occupying())
->orWhere(fn (Builder $query) => $query
->where('status', BookingStatus::Reserved)
->whereIn('status', BookingStatus::holding())
->where('hold_expires_at', '>', now())));
}
@@ -185,6 +197,6 @@ public function nights(): int
public function isHoldActive(): bool
{
return $this->status === BookingStatus::Reserved && $this->hold_expires_at?->isFuture();
return in_array($this->status, BookingStatus::holding(), true) && $this->hold_expires_at?->isFuture();
}
}
+13 -1
View File
@@ -67,7 +67,19 @@ protected function withMarketingConsent(Builder $query): Builder
public function anonymize(): void
{
DB::transaction(function (): void {
$this->bookings()->update(['message' => null]);
$this->bookings()->update([
'message' => null,
'internal_notes' => null,
'offer_message' => null,
'referral_source' => null,
'utm_source' => null,
'utm_medium' => null,
'utm_campaign' => null,
]);
Review::query()->whereIn('booking_id', $this->bookings()->select('id'))->update([
'display_name' => 'Gast',
'private_feedback' => null,
]);
$this->forceFill([
'first_name' => 'Anonymisiert',
+8
View File
@@ -23,6 +23,14 @@ public function __construct(
public ?bool $promoCodeApplied = null,
) {}
/**
* The same quote with one more line, e.g. a manual adjustment in an offer.
*/
public function withLine(QuoteLine $line): self
{
return new self($this->arrival, $this->departure, $this->guests, [...$this->lines, $line], $this->depositPercent, $this->balanceDueOn, $this->promoCodeApplied);
}
/**
* Total of all special offer discounts as a positive amount.
*/
+6
View File
@@ -2,8 +2,11 @@
namespace App\Providers;
use App\Support\StripImageMetadata;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider;
use Spatie\MediaLibrary\MediaCollections\Events\MediaHasBeenAddedEvent;
class AppServiceProvider extends ServiceProvider
{
@@ -20,6 +23,9 @@ public function register(): void
*/
public function boot(): void
{
// Photos: remove metadata (GPS position, camera data) from uploaded originals, which stay downloadable.
Event::listen(MediaHasBeenAddedEvent::class, fn (MediaHasBeenAddedEvent $event) => StripImageMetadata::strip($event->media));
// On Strato the domain points at the deployment folder and .htaccess forwards to current/public;
// without a fixed root, some URLs (e.g. /sitemap.xml) would be generated with /current/public.
if (! $this->app->environment('local', 'testing')) {
@@ -3,7 +3,6 @@
namespace App\Providers\Filament;
use App\Enums\AdminMode;
use App\Http\Middleware\RequireTwoFactorForAdmins;
use App\Models\User;
use Filament\Actions\Action;
use Filament\Auth\MultiFactor\App\AppAuthentication;
@@ -42,12 +41,11 @@ public function panel(Panel $panel): Panel
->path('admin')
->login()
->profile(isSimple: false)
// Two-factor login with an authenticator app (TOTP) and recovery codes; mandatory for administrators.
// Two-factor login with an authenticator app (TOTP) and recovery codes; mandatory for every account.
->multiFactorAuthentication(
[AppAuthentication::make()->brandName('FeWo Stommer')->recoverable()],
isRequired: true,
)
->multiFactorAuthenticationRequiredMiddlewareName(RequireTwoFactorForAdmins::class)
->userMenuItems([
'admin-mode' => Action::make('switchAdminMode')
->label(fn (): string => (self::currentUser()?->adminMode() ?? AdminMode::Expert)->other()->switchLabel())
+43
View File
@@ -0,0 +1,43 @@
<?php
namespace App\Support;
use Spatie\Image\Image;
use Spatie\MediaLibrary\MediaCollections\Models\Media;
use Throwable;
/**
* Re-encodes an uploaded original photo without its metadata (EXIF/XMP: GPS position, camera, owner).
* The orientation is applied first, so the photo keeps its correct rotation. Failures never block an upload.
*/
class StripImageMetadata
{
private const TYPES = ['image/jpeg', 'image/png', 'image/webp'];
public static function strip(Media $media): bool
{
if (! in_array($media->mime_type, self::TYPES, true) || $media->getCustomProperty('metadata_stripped')) {
return false;
}
$path = $media->getPath();
if (! is_file($path)) {
return false;
}
try {
Image::load($path)->quality(90)->save($path);
} catch (Throwable $exception) {
report($exception);
return false;
}
clearstatcache(true, $path);
$media->size = (int) filesize($path);
$media->setCustomProperty('metadata_stripped', true);
$media->saveQuietly();
return true;
}
}
+2
View File
@@ -1,6 +1,7 @@
<?php
use App\Http\Middleware\ResolveTheme;
use App\Http\Middleware\SecurityHeaders;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
@@ -14,6 +15,7 @@
)
->withMiddleware(function (Middleware $middleware): void {
$middleware->web(append: [ResolveTheme::class]);
$middleware->append(SecurityHeaders::class);
})
->withExceptions(function (Exceptions $exceptions): void {
$exceptions->shouldRenderJsonWhen(
+11 -1
View File
@@ -36,12 +36,22 @@
'contract' => [
'label' => 'Mietvertrag',
'fields' => [
'contract.intro' => ['label' => 'Einleitung', 'type' => 'textarea', 'default' => 'Zwischen Vermieter und Mieter wird folgender Mietvertrag über die Ferienwohnung geschlossen. Der Vertrag kommt mit der Buchungsbestätigung des Vermieters zustande.'],
'contract.intro' => ['label' => 'Einleitung', 'type' => 'textarea', 'default' => 'Zwischen Vermieter und Mieter wird folgender Mietvertrag über die Ferienwohnung geschlossen. Der Vertrag kommt zustande, wenn der Mieter das Angebot des Vermieters annimmt.'],
'contract.terms' => ['label' => 'Mietbedingungen', 'type' => 'richtext', 'default' => '<p><strong>[MUSTER – bitte durch Ihre geprüften Mietbedingungen ersetzen]</strong></p><ol><li>Die Wohnung darf nur von den im Vertrag genannten Personen genutzt werden.</li><li>Der Mieter behandelt die Wohnung und das Inventar pfleglich und meldet Schäden unverzüglich.</li><li>Die Kurtaxe ist nicht im Mietpreis enthalten und wird vor Ort entrichtet.</li></ol>'],
'contract.closing' => ['label' => 'Schlusstext', 'type' => 'textarea', 'default' => 'Wir freuen uns auf Ihren Besuch und wünschen Ihnen schon jetzt einen erholsamen Aufenthalt an der Ostsee.'],
],
],
'offer' => [
'label' => 'Angebot & Annahme',
'fields' => [
'offer.intro' => ['label' => 'Einleitung in der Angebots-E-Mail', 'type' => 'textarea', 'default' => 'vielen Dank für Ihre Anfrage. Gern machen wir Ihnen folgendes Angebot – den Vertragsentwurf mit allen Bedingungen finden Sie im Anhang.'],
'offer.contract_note' => ['label' => 'Hinweis im Vertragsentwurf', 'type' => 'textarea', 'default' => 'Dies ist ein Angebot. Der Mietvertrag wird verbindlich, sobald Sie das Angebot über den Link in unserer E-Mail annehmen.'],
'offer.accept_note' => ['label' => 'Hinweis über dem Annahme-Button', 'type' => 'textarea', 'default' => 'Mit Klick auf den Button nehmen Sie unser Angebot verbindlich an. Damit kommt der Mietvertrag zu den oben genannten Bedingungen zustande und die genannten Zahlungen werden fällig.'],
'offer.accept_button' => ['label' => 'Beschriftung des Annahme-Buttons', 'type' => 'text', 'default' => 'Angebot zahlungspflichtig annehmen'],
],
],
'legal' => [
'label' => 'Rechtliches',
'fields' => [
+18
View File
@@ -46,6 +46,24 @@
*/
'guest_retention_years' => (int) env('FEWO_GUEST_RETENTION_YEARS', 10),
/*
| Further retention periods (docs/LOESCHKONZEPT.md). The defaults are PROPOSALS – please have them
| confirmed according to the general legal opinion (tax advisor / legal advice) and adjust here.
*/
// Daily database backup (php artisan backup:database): number of dumps kept in storage/app/private/backups.
'backup' => [
'keep' => (int) env('FEWO_BACKUP_KEEP', 14),
],
'retention' => [
// Requests/offers that never became a binding booking: guest data anonymised after … months.
'inquiry_months' => (int) env('FEWO_RETENTION_INQUIRY_MONTHS', 6),
// Text excerpt of processed portal e-mails (may contain names) is removed after … days.
'portal_email_excerpt_days' => (int) env('FEWO_RETENTION_PORTAL_EMAIL_EXCERPT_DAYS', 90),
// Marketing attribution (UTM parameters, "how did you hear about us") is removed after … months.
'attribution_months' => (int) env('FEWO_RETENTION_ATTRIBUTION_MONTHS', 24),
],
/*
|--------------------------------------------------------------------------
| Portal synchronisation
@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Booking path 1: request → offer by the landlord → acceptance by the guest (docs/KONZEPT.md §6a).
*/
public function up(): void
{
Schema::table('bookings', function (Blueprint $table) {
$table->unsignedSmallInteger('offer_version')->default(0)->after('hold_expires_at');
$table->timestamp('offer_sent_at')->nullable()->after('offer_version');
$table->text('offer_message')->nullable()->after('offer_sent_at');
$table->string('offer_path')->nullable()->after('offer_message');
$table->integer('price_adjustment')->nullable()->after('promo_code');
$table->string('price_adjustment_label')->nullable()->after('price_adjustment');
$table->timestamp('accepted_at')->nullable()->after('confirmed_at');
$table->json('acceptance')->nullable()->after('accepted_at');
$table->string('declined_by', 10)->nullable()->after('acceptance');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('bookings', function (Blueprint $table) {
$table->dropColumn(['offer_version', 'offer_sent_at', 'offer_message', 'offer_path', 'price_adjustment', 'price_adjustment_label', 'accepted_at', 'acceptance', 'declined_by']);
});
}
};
+13 -2
View File
@@ -110,8 +110,7 @@ ## 7. Zugang zur Verwaltung (`/admin`)
**Passwort vergessen:** Ein Administrator vergibt unter System › Benutzer › Bearbeiten ein neues Passwort (eine Selbst-Zurücksetzung per E-Mail gibt es bewusst nicht). **Handy verloren:** dort Aktion „2FA zurücksetzen“ – die Person richtet die 2FA bei der nächsten Anmeldung neu ein.
**Zwei-Faktor-Anmeldung (2FA):** Filament-eigene Lösung mit Authenticator-App (TOTP, z. B. Bitwarden/Vaultwarden, Google oder Microsoft Authenticator) und Wiederherstellungscodes.
- **Pflicht für Administratoren:** Nach der ersten Anmeldung wird man auf die Einrichtungsseite geleitet (QR-Code scannen, Code bestätigen, Wiederherstellungscodes sichern). Umgesetzt mit `App\Http\Middleware\RequireTwoFactorForAdmins`.
- **Freiwillig für andere Rollen:** im Profil (Avatar oben rechts › Profil).
- **Pflicht für alle Konten** (Entscheidung 22.10.2026): Nach der ersten Anmeldung wird man auf die Einrichtungsseite geleitet (QR-Code scannen, Code bestätigen, Wiederherstellungscodes sichern). Filament-Standard (`multiFactorAuthentication(isRequired: true)`).
- Schlüssel und Codes liegen verschlüsselt (mit `APP_KEY`) in `users.app_authentication_secret` / `app_authentication_recovery_codes`.
- **Handy verloren:** Anmeldung mit einem Wiederherstellungscode. Sind auch die weg, setzt ein Administrator mit Serverzugang die 2FA zurück:
```bash
@@ -121,6 +120,18 @@ ## 7. Zugang zur Verwaltung (`/admin`)
Lokal (nur Entwicklung, `php artisan migrate:fresh --seed`): `admin@example.com` / `password`, 2FA wird bei der ersten Anmeldung eingerichtet.
## 7a. Datensicherung, Löschfristen, Automationen
- **Datenbank-Backup:** täglich 02:30 per Scheduler (`php artisan backup:database`) als `shared/storage/app/private/backups/fewo-<datum>.sql.gz`; es bleiben die neuesten 14 (`FEWO_BACKUP_KEEP`). Wiederherstellen: Datei entpacken und mit `mysql` bzw. phpMyAdmin (Strato) einspielen.
- **Sicherung aufs NAS / einen Rechner** (holt eine frische Datenbank-Sicherung plus Fotos und Verträge; auf dem Server wird nichts verändert):
```bash
bash scripts/backup-pull.sh staging /pfad/zum/nas/fewo-backup
```
Regelmäßig z. B. per Aufgabenplanung des NAS/PC ausführen (braucht den SSH-Schlüssel aus §4).
- **Löschfristen** (Vorschläge, rechtlich zu bestätigen – `config/fewo.php` bzw. `.env`): Gästedaten 10 Jahre nach letztem Aufenthalt (`FEWO_GUEST_RETENTION_YEARS`), nie verbindlich gewordene Anfragen/Angebote 6 Monate (`FEWO_RETENTION_INQUIRY_MONTHS`), Textauszüge von Portal-Mails 90 Tage (`FEWO_RETENTION_PORTAL_EMAIL_EXCERPT_DAYS`), Herkunftsangaben/UTM 24 Monate (`FEWO_RETENTION_ATTRIBUTION_MONTHS`). Läuft täglich 03:00. Anonymisierung ersetzt Name, Kontaktdaten, Nachrichten, Notizen, Herkunft und Bewertungs-Anzeigenamen; Buchung, Preise und Zahlungen bleiben als Beleg.
- **Automationen (n8n):** Token bitte als Header `Authorization: Bearer <token>` senden (landet nicht in Server-Logs); `?token=` funktioniert übergangsweise weiter.
- **Fotos:** Beim Hochladen werden Metadaten (GPS, Kamera) aus dem Original entfernt; bestehende Fotos einmalig: `php artisan photos:strip-metadata`.
## 8. Bekannte Eigenheiten und Lösungen
| Problem | Ursache | Lösung (umgesetzt) |
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

+8
View File
@@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="1 10 62 50">
<style>.navy{fill:#0B2E55}@media (prefers-color-scheme:dark){.navy{fill:#F6F2EA}}</style>
<circle cx="50" cy="34" r="9" fill="#F2C27A"/>
<path class="navy" d="M4 34 L28 16 L37 23 L37 18 L42 18 L42 27 L54 36 L49 36 L28 21 L7 37 Z"/>
<g class="navy"><rect x="24.5" y="25" width="3.5" height="3.5" rx=".5"/><rect x="29" y="25" width="3.5" height="3.5" rx=".5"/><rect x="24.5" y="29.5" width="3.5" height="3.5" rx=".5"/><rect x="29" y="29.5" width="3.5" height="3.5" rx=".5"/></g>
<path fill="#0286A2" d="M2 48 C10 40 20 37 28 38 C38 39 46 45 62 44 C54 50 44 51 36 49 C26 46 16 43 2 48 Z"/>
<path fill="#6DBFC2" d="M6 55 C14 50 22 48 30 49.5 C37 51 42 54 50 54.5 C44 57.5 36 57.5 30 56 C22 54 14 52.5 6 55 Z"/>
</svg>

After

Width:  |  Height:  |  Size: 790 B

+9
View File
@@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" role="img" aria-label="Ferienwohnung">
<title>Ferienwohnung</title>
<circle cx="88" cy="62" r="15" fill="var(--brand-sun, #F2C27A)"/>
<path fill="var(--brand-navy, #0B2E55)" d="M12 64 L52 34 L68 46 L68 36 L76 36 L76 52 C84 60 92 66 104 70 L94 70 C86 68 78 62 72 57 L52 42 L16 68 C13 70 10 66 12 64 Z"/>
<g fill="var(--brand-navy, #0B2E55)"><rect x="45" y="50" width="6" height="6" rx="1"/><rect x="53" y="50" width="6" height="6" rx="1"/><rect x="45" y="58" width="6" height="6" rx="1"/><rect x="53" y="58" width="6" height="6" rx="1"/></g>
<rect x="82" y="74" width="30" height="3.5" rx="1.75" fill="var(--brand-sun, #F2C27A)"/>
<path fill="var(--brand-teal, #0286A2)" d="M6 92 C18 80 32 74 46 75 C62 76 74 86 96 84 C86 92 74 94 62 92 C48 90 36 83 22 84 C16 85 10 88 6 92 Z"/>
<path fill="var(--brand-wave, #6DBFC2)" d="M12 100 C22 94 32 92 42 93 C54 94 62 100 76 100 C68 104 58 104 50 103 C40 101 30 98 12 100 Z"/>
</svg>

After

Width:  |  Height:  |  Size: 1000 B

+10
View File
@@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" role="img" aria-label="Lage">
<title>Lage</title>
<defs><clipPath id="icon-location-inner"><circle cx="60" cy="46" r="28"/></clipPath></defs>
<path fill="var(--brand-navy, #0B2E55)" fill-rule="evenodd" d="M60 6 C82 6 98 22 98 44 C98 66 74 88 60 112 C46 88 22 66 22 44 C22 22 38 6 60 6 Z M60 18 C45.6 18 34 29.6 34 44 C34 58.4 45.6 70 60 70 C74.4 70 86 58.4 86 44 C86 29.6 74.4 18 60 18 Z"/>
<g clip-path="url(#icon-location-inner)">
<circle cx="66" cy="46" r="13" fill="var(--brand-sun, #F2C27A)"/>
<path fill="var(--brand-teal, #0286A2)" d="M30 54 C40 46 52 44 62 47 C72 50 80 54 92 50 L92 58 C82 62 72 60 62 56 C52 52 42 52 30 60 Z"/>
<path fill="var(--brand-wave, #6DBFC2)" d="M30 64 C40 58 50 57 60 60 C70 63 80 64 92 60 L92 68 C80 72 70 70 60 67 C50 64 40 64 30 70 Z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 871 B

+5
View File
@@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" role="img" aria-label="Ostsee">
<title>Ostsee</title>
<path fill="var(--brand-teal, #0286A2)" d="M8 76 C20 60 36 52 52 56 C66 60 76 72 90 68 C98 66 102 58 98 50 C94 44 86 44 84 50 C88 48 92 52 90 56 C86 62 76 58 74 48 C72 38 82 30 92 32 C106 34 114 48 110 62 C106 78 88 86 72 82 C58 78 48 66 34 66 C24 66 16 70 8 76 Z"/>
<path fill="var(--brand-wave, #6DBFC2)" d="M10 90 C22 80 36 76 50 78 C64 80 76 90 104 82 C96 92 82 96 68 94 C54 92 42 86 30 86 C22 86 16 88 10 90 Z"/>
</svg>

After

Width:  |  Height:  |  Size: 547 B

+11
View File
@@ -0,0 +1,11 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" role="img" aria-label="Terrasse und Strand">
<title>Terrasse und Strand</title>
<defs><clipPath id="icon-terrace-sun"><rect x="70" y="20" width="40" height="34"/></clipPath></defs>
<circle cx="90" cy="46" r="15" fill="var(--brand-sun, #F2C27A)" clip-path="url(#icon-terrace-sun)"/>
<rect x="72" y="56" width="38" height="3" rx="1.5" fill="var(--brand-sun, #F2C27A)"/><rect x="80" y="63" width="22" height="3" rx="1.5" fill="var(--brand-sun, #F2C27A)"/>
<path fill="var(--brand-navy, #0B2E55)" d="M14 44 C18 30 30 22 44 22 C58 22 70 30 74 44 C68 40 62 40 56 42 C52 38 48 37 44 37 C40 37 36 38 32 42 C26 40 20 40 14 44 Z"/>
<rect x="42.5" y="36" width="3.5" height="38" fill="var(--brand-navy, #0B2E55)"/>
<path fill="var(--brand-navy, #0B2E55)" d="M24 52 L30 52 L44 70 L66 70 C68 70 69 72 68 74 L34 74 L28 84 L24 84 L30 73 Z M58 74 L62 74 L66 84 L62 84 Z"/>
<path fill="var(--brand-teal, #0286A2)" d="M8 94 C24 86 42 84 60 86 C78 88 92 88 112 82 C100 92 82 96 64 95 C46 94 28 90 8 94 Z"/>
<path fill="var(--brand-wave, #6DBFC2)" d="M14 102 C30 97 46 96 62 98 C76 100 88 100 104 97 C94 103 80 105 66 104 C50 103 32 100 14 102 Z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

+20
View File
@@ -0,0 +1,20 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1448 1000" role="img" aria-label="FeWo Stommer – Ferienwohnung in Kühlungsborn">
<title>FeWo Stommer – Ferienwohnung in Kühlungsborn</title>
<g transform="translate(200 -170) scale(0.86)">
<defs><clipPath id="logo-sun"><rect x="860" y="500" width="380" height="262"/></clipPath></defs>
<circle cx="1046" cy="708" r="140" fill="var(--brand-sun, #F2C27A)" clip-path="url(#logo-sun)"/>
<rect x="930" y="776" width="296" height="22" rx="11" fill="var(--brand-sun, #F2C27A)"/>
<rect x="1048" y="832" width="152" height="22" rx="11" fill="var(--brand-sun, #F2C27A)"/>
<path fill="var(--brand-navy, #0B2E55)" d="M118 716 L553 412 L750 549 L750 485 L826 485 L826 602 C905 685 990 748 1102 760 C1060 772 1000 774 960 768 C880 754 820 706 760 652 L553 476 L132 724 C124 728 114 722 118 716 Z"/>
<g fill="var(--brand-navy, #0B2E55)">
<rect x="492" y="553" width="50" height="50" rx="4"/><rect x="559" y="553" width="50" height="50" rx="4"/>
<rect x="492" y="617" width="50" height="50" rx="4"/><rect x="559" y="617" width="50" height="50" rx="4"/>
</g>
<path fill="var(--brand-teal, #0286A2)" d="M30 858 C140 750 280 672 400 670 C520 668 640 730 760 790 C870 845 980 845 1070 812 C990 872 880 888 780 868 C660 845 560 780 430 748 C300 718 160 760 30 858 Z"/>
<path fill="var(--brand-wave, #6DBFC2)" d="M62 865 C160 790 270 760 360 762 C470 764 560 815 650 860 C710 890 760 905 792 902 C740 920 690 925 630 912 C560 895 470 840 380 812 C280 785 170 812 62 865 Z"/>
</g>
<text x="724" y="760" text-anchor="middle" font-family="'Cormorant Garamond', 'Libre Caslon Text', Georgia, 'Times New Roman', serif" font-size="215" font-weight="600" textLength="1300" lengthAdjust="spacingAndGlyphs" fill="var(--brand-navy, #0B2E55)">FeWo Stommer</text>
<rect x="74" y="842" width="96" height="8" rx="4" fill="var(--brand-sun, #F2C27A)"/>
<rect x="1278" y="842" width="96" height="8" rx="4" fill="var(--brand-sun, #F2C27A)"/>
<text x="724" y="878" text-anchor="middle" font-family="'Figtree', 'Helvetica Neue', Arial, sans-serif" font-size="46" font-weight="500" textLength="1020" lengthAdjust="spacing" fill="var(--brand-navy, #0B2E55)">FERIENWOHNUNG IN KÜHLUNGSBORN</text>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

+14
View File
@@ -0,0 +1,14 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="20 390 1220 540" role="img" aria-label="FeWo Stommer">
<title>FeWo Stommer</title>
<defs><clipPath id="sun-horizon"><rect x="860" y="500" width="380" height="262"/></clipPath></defs>
<circle cx="1046" cy="708" r="140" fill="var(--brand-sun, #F2C27A)" clip-path="url(#sun-horizon)"/>
<rect x="930" y="776" width="296" height="22" rx="11" fill="var(--brand-sun, #F2C27A)"/>
<rect x="1048" y="832" width="152" height="22" rx="11" fill="var(--brand-sun, #F2C27A)"/>
<path fill="var(--brand-navy, #0B2E55)" d="M118 716 L553 412 L750 549 L750 485 L826 485 L826 602 C905 685 990 748 1102 760 C1060 772 1000 774 960 768 C880 754 820 706 760 652 L553 476 L132 724 C124 728 114 722 118 716 Z"/>
<g fill="var(--brand-navy, #0B2E55)">
<rect x="492" y="553" width="50" height="50" rx="4"/><rect x="559" y="553" width="50" height="50" rx="4"/>
<rect x="492" y="617" width="50" height="50" rx="4"/><rect x="559" y="617" width="50" height="50" rx="4"/>
</g>
<path fill="var(--brand-teal, #0286A2)" d="M30 858 C140 750 280 672 400 670 C520 668 640 730 760 790 C870 845 980 845 1070 812 C990 872 880 888 780 868 C660 845 560 780 430 748 C300 718 160 760 30 858 Z"/>
<path fill="var(--brand-wave, #6DBFC2)" d="M62 865 C160 790 270 760 360 762 C470 764 560 815 650 860 C710 890 760 905 792 902 C740 920 690 925 630 912 C560 895 470 840 380 812 C280 785 170 812 62 865 Z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

+9
View File
@@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1600 220" preserveAspectRatio="xMidYMid meet" role="presentation" aria-hidden="true">
<defs><clipPath id="wave-divider-horizon"><rect x="1020" y="40" width="120" height="82"/></clipPath></defs>
<circle cx="1080" cy="120" r="46" fill="var(--brand-sun, #F2C27A)" clip-path="url(#wave-divider-horizon)"/>
<path fill="var(--brand-sun, #F2C27A)" d="M1030 126 H1130 A3 3 0 0 1 1130 132 H1030 A3 3 0 0 1 1030 126 Z M1052 142 H1108 A3 3 0 0 1 1108 148 H1052 A3 3 0 0 1 1052 142 Z"/>
<path fill="var(--brand-navy, #0B2E55)" d="M948 52 C958 44 972 44 982 54 C990 44 1004 40 1018 44 C1004 46 994 54 986 66 C980 58 966 50 948 52 Z M900 74 C906 69 914 69 920 75 C925 69 933 67 941 69 C933 71 927 76 922 83 C918 78 910 73 900 74 Z"/>
<path fill="var(--brand-teal, #0286A2)" d="M10 170 C120 120 220 104 330 120 C440 136 520 164 640 140 C760 116 820 80 900 82 C990 84 1040 130 1120 156 C1220 188 1380 170 1590 120 C1420 186 1250 214 1110 186 C1020 168 960 120 890 112 C810 104 760 150 650 168 C530 188 440 160 330 144 C220 130 120 136 10 170 Z"/>
<path fill="var(--brand-wave, #6DBFC2)" d="M40 178 C140 150 240 146 330 160 C410 172 470 184 540 176 C470 192 400 192 330 182 C240 170 140 168 40 178 Z M580 172 C680 150 760 120 860 118 C960 116 1020 160 1120 188 C1040 178 980 150 900 140 C820 130 720 160 580 172 Z M1260 190 C1360 184 1460 166 1560 140 C1480 176 1380 196 1260 190 Z"/>
<path fill="var(--brand-navy, #0B2E55)" d="M870 84 C930 80 980 104 1020 130 C1050 150 1070 160 1100 168 C1060 166 1030 150 1000 130 C960 104 920 90 870 84 Z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

@@ -30,6 +30,15 @@ @theme inline {
--font-sans: 'Figtree', ui-sans-serif, system-ui, sans-serif;
}
/* Brand graphics (public/brand, inlined via partials/brand): navy follows the text colour, so the logo stays
visible in dark appearances; teal, light wave and sun keep the brand colours unless a theme overrides them. */
:root {
--brand-navy: var(--ink);
--brand-teal: #0286a2;
--brand-wave: #6dbfc2;
--brand-sun: #f2c27a;
}
@layer base {
html {
scroll-behavior: smooth;
@@ -20,6 +20,8 @@
<meta property="og:image" content="{{ $ogImage }}">
@endisset
<link rel="canonical" href="{{ url()->current() }}">
<link rel="icon" href="{{ asset('brand/favicon.svg') }}" type="image/svg+xml">
<link rel="apple-touch-icon" href="{{ asset('brand/apple-touch-icon.png') }}">
@if ($theme->isPreview || ! app()->isProduction())
<meta name="robots" content="noindex">
@endif
@@ -0,0 +1,16 @@
{{--
Inline brand graphic from public/brand/<name>.svg (mark, logo, wave-divider, icon-apartment, icon-sea,
icon-terrace, icon-location). Inline, so the colours follow the CSS variables --brand-navy/-teal/-wave/-sun
(theme-base.css maps navy to the text colour, so it stays visible in dark appearances).
Variables: $name, $class (optional), $label (optional; without it the graphic is decorative).
--}}
@php
static $brandSvgs = [];
$brandSvgs[$name] ??= is_file(public_path("brand/{$name}.svg")) ? file_get_contents(public_path("brand/{$name}.svg")) : '';
$brandUid = 'b'.\Illuminate\Support\Str::lower(\Illuminate\Support\Str::random(6));
$brandSvg = preg_replace(['/\s(role|aria-label)="[^"]*"/', '/<title>.*?<\/title>/s'], '', $brandSvgs[$name]);
$brandSvg = preg_replace(['/id="([^"]+)"/', '/url\(#([^)]+)\)/'], ['id="$1-'.$brandUid.'"', 'url(#$1-'.$brandUid.')'], $brandSvg);
$brandAttributes = 'class="'.e($class ?? '').'" '.(isset($label) ? 'role="img" aria-label="'.e($label).'"' : 'aria-hidden="true" focusable="false"');
$brandSvg = preg_replace('/<svg\s/', '<svg '.$brandAttributes.' ', $brandSvg, 1);
@endphp
{!! $brandSvg !!}
@@ -1,7 +1,10 @@
<footer class="mt-8 border-t border-line">
<div class="mt-16 px-4" aria-hidden="true">
@include('theme::partials.brand', ['name' => 'wave-divider', 'class' => 'mx-auto block h-auto w-full max-w-4xl'])
</div>
<footer class="border-t border-line">
<div class="mx-auto flex max-w-7xl flex-wrap justify-between gap-x-16 gap-y-6 px-4 py-14 text-sm text-muted sm:px-8">
<div>
<span class="font-display text-2xl text-ink">{{ $theme->site->name }}</span><br>
<span class="flex items-center gap-2 font-display text-2xl text-ink">@include('theme::partials.brand', ['name' => 'mark', 'class' => 'h-7 w-auto']){{ $theme->site->name }}</span>
{{ $theme->property()?->address }}
</div>
<div>
@@ -1,8 +1,11 @@
<header class="relative z-20">
<div class="mx-auto flex max-w-7xl items-center justify-between gap-6 px-4 py-5 sm:px-8">
<a href="{{ route('home') }}" class="flex flex-col leading-tight">
<span class="font-display text-[1.875rem] font-semibold tracking-wide">{{ str($theme->site->name)->afterLast(' ') }}</span>
<span class="text-[11px] tracking-[0.24em] text-muted uppercase">Ferienwohnung · Kühlungsborn</span>
<a href="{{ route('home') }}" class="flex items-center gap-3 leading-tight" aria-label="{{ $theme->site->name }} – Startseite">
@include('theme::partials.brand', ['name' => 'mark', 'class' => 'h-11 w-auto shrink-0 sm:h-12'])
<span class="flex flex-col">
<span class="font-display text-[1.875rem] font-semibold tracking-wide">{{ str($theme->site->name)->afterLast(' ') }}</span>
<span class="text-[11px] tracking-[0.24em] text-muted uppercase">Ferienwohnung · Kühlungsborn</span>
</span>
</a>
<nav aria-label="Hauptnavigation" class="hidden lg:block">
@@ -10,5 +10,7 @@
decoding="async"
class="{{ $class ?? '' }}">
@else
<div class="{{ $class ?? '' }} flex items-center justify-center bg-line/60 text-sm text-muted" role="img" aria-label="Bild folgt">Bild folgt</div>
<div class="{{ $class ?? '' }} flex items-center justify-center bg-surface" role="img" aria-label="Bild folgt">
<img src="{{ asset('brand/coastal-illustration-1200.webp') }}" alt="" loading="lazy" decoding="async" class="h-full max-h-full w-full object-contain p-6 opacity-90">
</div>
@endif
@@ -2,16 +2,16 @@
@if ($heading)<h2 id="{{ $sectionId }}-title" class="heading-display mb-8">{{ $heading }}</h2>@endif
<ul class="reveal grid grid-cols-2 gap-6 border-y border-line lg:grid-cols-4">
@if ($property?->size_sqm)
<li class="py-7"><span class="block font-display text-[2.5rem] leading-none">{{ $property->size_sqm }} m²</span><span class="text-sm text-muted">Wohnfläche</span></li>
<li class="py-7">@include('theme::partials.brand', ['name' => 'icon-apartment', 'class' => 'mb-3 size-12'])<span class="block font-display text-[2.5rem] leading-none">{{ $property->size_sqm }} m²</span><span class="text-sm text-muted">Wohnfläche</span></li>
@endif
@if ($property)
<li class="py-7"><span class="block font-display text-[2.5rem] leading-none">1–{{ $property->max_guests }}</span><span class="text-sm text-muted">Gäste</span></li>
<li class="py-7">@include('theme::partials.brand', ['name' => 'icon-terrace', 'class' => 'mb-3 size-12'])<span class="block font-display text-[2.5rem] leading-none">1–{{ $property->max_guests }}</span><span class="text-sm text-muted">Gäste</span></li>
@endif
@if ($fromPrice)
<li class="py-7"><span class="block font-display text-[2.5rem] leading-none">ab {{ \App\Support\Money::format((int) $fromPrice) }}</span><span class="text-sm text-muted">pro Nacht</span></li>
<li class="py-7">@include('theme::partials.brand', ['name' => 'icon-sea', 'class' => 'mb-3 size-12'])<span class="block font-display text-[2.5rem] leading-none">ab {{ \App\Support\Money::format((int) $fromPrice) }}</span><span class="text-sm text-muted">pro Nacht</span></li>
@endif
@if ($highlights->isNotEmpty())
<li class="py-7"><span class="block font-display text-[2.5rem] leading-none">inklusive</span><span class="text-sm text-muted">{{ $highlights->take(3)->implode(', ') }}</span></li>
<li class="py-7">@include('theme::partials.brand', ['name' => 'icon-location', 'class' => 'mb-3 size-12'])<span class="block font-display text-[2.5rem] leading-none">inklusive</span><span class="text-sm text-muted">{{ $highlights->take(3)->implode(', ') }}</span></li>
@endif
</ul>
</section>
@@ -5,8 +5,10 @@
<h2 id="{{ $sectionId }}-title" class="heading-display">{{ $heading }}</h2>
@if ($text)<div class="mt-6 text-band-muted [&_a]:underline [&_p]:mb-4">{{ $text }}</div>@endif
@if ($address)
<p class="mt-6 text-band-muted">{{ $address }}<br>
<a href="{{ $mapUrl }}" class="font-semibold text-band-ink underline" rel="noopener" target="_blank">Auf der Karte ansehen</a>
<p class="mt-6 flex items-start gap-3 text-band-muted [--brand-navy:var(--band-ink)]">
@include('theme::partials.brand', ['name' => 'icon-location', 'class' => 'size-10 shrink-0'])
<span>{{ $address }}<br>
<a href="{{ $mapUrl }}" class="font-semibold text-band-ink underline" rel="noopener" target="_blank">Auf der Karte ansehen</a></span>
</p>
@endif
</div>
@@ -215,10 +215,10 @@ class="mt-1 w-full rounded-lg border-line">
@disabled(! $pricing['quote'])
wire:loading.attr="disabled"
class="mt-5 w-full rounded-xl bg-accent px-4 py-3 font-semibold text-accent-ink transition hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50">
<span wire:loading.remove wire:target="submit">Termin vormerken &amp; Angebot erhalten</span>
<span wire:loading.remove wire:target="submit">Unverbindlich anfragen</span>
<span wire:loading wire:target="submit">Wird gesendet …</span>
</button>
<p class="mt-2 text-center text-xs text-muted">Kostenlos und unverbindlich. Verbindlich wird die Buchung erst mit unserer Bestätigung.</p>
<p class="mt-2 text-center text-xs text-muted">Kostenlos und unverbindlich. Wir halten den Termin für Sie frei und senden Ihnen ein Angebot per E-Mail – verbindlich wird die Buchung erst, wenn Sie es annehmen.</p>
</form>
</section>
</div>
@@ -3,7 +3,11 @@
Guten Tag {{ $booking->guest->full_name }},
@if ($booking->accepted_at)
vielen Dank – Sie haben unser Angebot am {{ $booking->accepted_at->format('d.m.Y') }} um {{ $booking->accepted_at->format('H:i') }} Uhr angenommen. Damit ist Ihre Buchung der **{{ $booking->property->name }}** verbindlich.
@else
wir freuen uns, Ihre Buchung der **{{ $booking->property->name }}** verbindlich zu bestätigen.
@endif
**Anreise:** {{ $booking->arrival->translatedFormat('l, d.m.Y') }}@if ($booking->property->check_in_time) ab {{ substr($booking->property->check_in_time, 0, 5) }} Uhr @endif<br>
**Abreise:** {{ $booking->departure->translatedFormat('l, d.m.Y') }}@if ($booking->property->check_out_time) bis {{ substr($booking->property->check_out_time, 0, 5) }} Uhr @endif<br>
@@ -20,6 +20,6 @@
@endif
<x-mail::button :url="\App\Filament\Resources\Bookings\BookingResource::getUrl('view', ['record' => $booking])">
Anfrage bestätigen oder ablehnen
Angebot senden oder Anfrage ablehnen
</x-mail::button>
</x-mail::message>
@@ -0,0 +1,15 @@
<x-mail::message>
@if ($accepted)
# Angebot angenommen
{{ $booking->guest->full_name }} hat das Angebot **{{ $booking->reference }}** ({{ $booking->arrival->format('d.m.Y') }} – {{ $booking->departure->format('d.m.Y') }}, {{ \App\Support\Money::format($booking->total) }}) am {{ $booking->accepted_at?->format('d.m.Y') }} um {{ $booking->accepted_at?->format('H:i') }} Uhr angenommen. Die Buchung ist verbindlich; Bestätigung und Mietvertrag wurden an den Gast gesendet.
@else
# Angebot abgelehnt
{{ $booking->guest->full_name }} hat das Angebot **{{ $booking->reference }}** ({{ $booking->arrival->format('d.m.Y') }} – {{ $booking->departure->format('d.m.Y') }}) abgelehnt. Der Zeitraum ist im Kalender wieder frei.
@endif
<x-mail::button :url="\App\Filament\Resources\Bookings\BookingResource::getUrl('view', ['record' => $booking])">
Buchung öffnen
</x-mail::button>
</x-mail::message>
+31
View File
@@ -0,0 +1,31 @@
<x-mail::message>
# Ihr Angebot für die {{ $booking->property->name }}
Guten Tag {{ $booking->guest->full_name }},
{{ \App\Support\Content::get('offer.intro') }}
**Anreise:** {{ $booking->arrival->translatedFormat('l, d.m.Y') }}<br>
**Abreise:** {{ $booking->departure->translatedFormat('l, d.m.Y') }}<br>
**Personen:** {{ $booking->guests }}<br>
**Angebotsnummer:** {{ $booking->reference }}
@include('mail.partials.quote')
@if ($booking->offer_message)
{{ $booking->offer_message }}
@endif
Das Angebot gilt **bis {{ $booking->hold_expires_at->format('d.m.Y, H:i') }} Uhr**; bis dahin halten wir den Zeitraum für Sie frei.
<x-mail::button :url="$offerUrl">
Angebot ansehen und annehmen
</x-mail::button>
Auf der Angebotsseite können Sie das Angebot annehmen oder ablehnen. Erst mit Ihrer Annahme wird die Buchung verbindlich; Sie erhalten dann sofort die Buchungsbestätigung mit dem Mietvertrag.
Bei Fragen antworten Sie einfach auf diese E-Mail oder rufen Sie uns an: {{ config('fewo.owner.phone') }}
Herzliche Grüße<br>
{{ config('fewo.owner.name') }}
</x-mail::message>
@@ -1,9 +1,9 @@
<x-mail::message>
# Vormerkung abgelaufen
# {{ $booking->offer_version > 0 ? 'Angebot abgelaufen' : 'Vormerkung abgelaufen' }}
Die Anfrage **{{ $booking->reference }}** von {{ $booking->guest->full_name }} ({{ $booking->arrival->format('d.m.Y') }} – {{ $booking->departure->format('d.m.Y') }}) wurde nicht rechtzeitig bestätigt. Der Zeitraum ist im Kalender wieder frei.
Die Anfrage **{{ $booking->reference }}** von {{ $booking->guest->full_name }} ({{ $booking->arrival->format('d.m.Y') }} – {{ $booking->departure->format('d.m.Y') }}) {{ $booking->offer_version > 0 ? 'wurde vom Gast nicht rechtzeitig angenommen' : 'wurde nicht rechtzeitig beantwortet' }}. Der Zeitraum ist im Kalender wieder frei.
Sie können die Anfrage weiterhin bestätigen, sofern der Zeitraum noch frei ist.
Sie können weiterhin ein (neues) Angebot senden, sofern der Zeitraum noch frei ist.
<x-mail::button :url="\App\Filament\Resources\Bookings\BookingResource::getUrl('view', ['record' => $booking])">
Anfrage öffnen
@@ -3,16 +3,18 @@
Guten Tag {{ $booking->guest->full_name }},
wir haben Ihre Anfrage für die **{{ $booking->property->name }}** erhalten und den Zeitraum für Sie **bis {{ $booking->hold_expires_at->format('d.m.Y, H:i') }} Uhr vorgemerkt**.
wir haben Ihre unverbindliche Anfrage für die **{{ $booking->property->name }}** erhalten und den Zeitraum für Sie **bis {{ $booking->hold_expires_at->format('d.m.Y, H:i') }} Uhr vorgemerkt**.
**Anreise:** {{ $booking->arrival->translatedFormat('l, d.m.Y') }}<br>
**Abreise:** {{ $booking->departure->translatedFormat('l, d.m.Y') }}<br>
**Personen:** {{ $booking->guests }}<br>
**Anfragenummer:** {{ $booking->reference }}
**Voraussichtlicher Preis laut Preisliste:**
@include('mail.partials.quote')
Wir prüfen Ihre Anfrage und melden uns in Kürze mit der Buchungsbestätigung. Erst mit unserer Bestätigung ist die Buchung verbindlich.
Wir prüfen Ihre Anfrage und senden Ihnen in Kürze **unser Angebot** per E-Mail. Verbindlich wird die Buchung erst, wenn Sie dieses Angebot annehmen.
@if ($booking->message)
**Ihre Nachricht:**<br>
+93
View File
@@ -0,0 +1,93 @@
@php($money = fn (int $cents): string => \App\Support\Money::format($cents))
@extends('theme::layouts.app', ['title' => 'Ihr Angebot'])
@push('head')
<meta name="robots" content="noindex">
@endpush
@section('content')
<div class="mx-auto max-w-3xl px-4 py-14 sm:px-8">
<p class="eyebrow">Angebot {{ $booking->reference }}</p>
<h1 class="heading-display">{{ $booking->property->name }}</h1>
<p class="mt-2 text-muted">für {{ $booking->guest->full_name }}</p>
@if (session('offer.success'))
<div class="mt-8 rounded border border-accent bg-surface p-5" role="status">{{ session('offer.success') }}</div>
@endif
@if (session('offer.error') || $problem)
<div class="mt-8 rounded border border-line bg-surface p-5" role="alert">{{ session('offer.error') ?? $problem }}</div>
@endif
@if (! session('offer.success') && ! $problem)
@if ($booking->status === \App\Enums\BookingStatus::Declined)
<div class="mt-8 rounded border border-line bg-surface p-5">Dieses Angebot wurde abgelehnt.</div>
@elseif (in_array($booking->status, \App\Enums\BookingStatus::occupying(), true))
<div class="mt-8 rounded border border-accent bg-surface p-5">Dieses Angebot wurde @if ($booking->accepted_at) am {{ $booking->accepted_at->format('d.m.Y') }} @endif angenommen – Ihre Buchung ist verbindlich.</div>
@elseif ($booking->status === \App\Enums\BookingStatus::Expired)
<div class="mt-8 rounded border border-line bg-surface p-5">{{ \App\Exceptions\ReservationException::offerExpired()->getMessage() }}</div>
@endif
@endif
<section class="mt-10 rounded bg-surface p-7" aria-labelledby="offer-stay">
<h2 id="offer-stay" class="font-display text-2xl">Ihr Aufenthalt</h2>
<dl class="mt-4 grid grid-cols-[auto_1fr] gap-x-6 gap-y-1">
<dt class="text-muted">Anreise</dt><dd>{{ $booking->arrival->translatedFormat('l, d.m.Y') }}@if ($booking->property->check_in_time) ab {{ substr($booking->property->check_in_time, 0, 5) }} Uhr @endif</dd>
<dt class="text-muted">Abreise</dt><dd>{{ $booking->departure->translatedFormat('l, d.m.Y') }}@if ($booking->property->check_out_time) bis {{ substr($booking->property->check_out_time, 0, 5) }} Uhr @endif</dd>
<dt class="text-muted">Nächte</dt><dd>{{ $booking->nights() }}</dd>
<dt class="text-muted">Personen</dt><dd>{{ $booking->guests }}</dd>
@if ($booking->status === \App\Enums\BookingStatus::OfferSent)
<dt class="text-muted">Gültig bis</dt><dd>{{ $booking->hold_expires_at?->format('d.m.Y, H:i') }} Uhr</dd>
@endif
</dl>
<h2 class="mt-8 font-display text-2xl">Preis</h2>
<table class="mt-3 w-full">
@foreach ($booking->quote['lines'] ?? [] as $line)
<tr class="border-b border-line"><td class="py-2">{{ $line['label'] }}</td><td class="py-2 text-right whitespace-nowrap">{{ $money($line['amount']) }}</td></tr>
@endforeach
<tr class="font-semibold"><td class="pt-3">Gesamtpreis</td><td class="pt-3 text-right">{{ $money($booking->total) }}</td></tr>
</table>
<p class="mt-3 text-sm text-muted">
@if ($booking->balance_due_on->lessThanOrEqualTo(today()->addDays(config('fewo.deposit_due_days'))))
Da die Anreise kurz bevorsteht, ist der Gesamtbetrag innerhalb von {{ config('fewo.deposit_due_days') }} Tagen nach Buchung fällig.
@else
Anzahlung {{ $money($booking->deposit) }} innerhalb von {{ config('fewo.deposit_due_days') }} Tagen nach Buchung,
Restbetrag {{ $money($booking->total - $booking->deposit) }} bis {{ $booking->balance_due_on->format('d.m.Y') }}.
@endif
Die Kurtaxe ist nicht enthalten und wird vor Ort entrichtet.
</p>
@if ($booking->offer_message)
<p class="mt-6 rounded border border-line p-4">{{ $booking->offer_message }}</p>
@endif
<h2 class="mt-8 font-display text-2xl">Bedingungen</h2>
<div class="prose-theme mt-3">{{ \App\Support\Content::html('contract.terms') }}</div>
@if (\App\Support\Content::get('stay.cancellation'))
<h3 class="mt-6 font-semibold">Rücktritt / Stornierung</h3>
<div class="prose-theme mt-2">{{ \App\Support\Content::html('stay.cancellation') }}</div>
@endif
<p class="mt-4 text-sm text-muted">Den vollständigen Vertragsentwurf finden Sie als PDF im Anhang unserer E-Mail.</p>
</section>
@if ($canAnswer)
<section class="mt-8 rounded bg-surface p-7" aria-label="Angebot annehmen oder ablehnen">
<form method="post" action="{{ $acceptUrl }}">
@csrf
<label class="flex items-start gap-3">
<input type="checkbox" name="terms" value="1" required class="mt-1">
<span>Ich habe die Angaben und Bedingungen dieses Angebots gelesen.</span>
</label>
@error('terms')<p class="mt-1 text-sm" role="alert">{{ $message }}</p>@enderror
<p class="mt-4 text-sm text-muted">{{ \App\Support\Content::get('offer.accept_note') }}</p>
<button type="submit" class="btn-accent mt-4 w-full sm:w-auto">{{ \App\Support\Content::get('offer.accept_button') }}</button>
</form>
<form method="post" action="{{ $rejectUrl }}" class="mt-6 border-t border-line pt-4">
@csrf
<button type="submit" class="text-sm text-muted underline hover:text-ink">Angebot ablehnen</button>
</form>
</section>
@endif
<p class="mt-8 text-sm text-muted">Fragen? {{ config('fewo.owner.name') }} · {{ config('fewo.owner.phone') }} · <a class="underline" href="mailto:{{ config('fewo.owner.email') }}">{{ config('fewo.owner.email') }}</a></p>
</div>
@endsection
+8 -2
View File
@@ -25,8 +25,14 @@
<body>
<div class="footer">{{ config('fewo.owner.name') }} · {{ config('fewo.owner.street') }} · {{ config('fewo.owner.city') }} · {{ config('fewo.owner.phone') }} · {{ config('fewo.owner.email') }}</div>
<h1>Mietvertrag Ferienwohnung</h1>
<p class="muted">Buchungsnummer {{ $booking->reference }} · ausgestellt am {{ ($booking->confirmed_at ?? now())->format('d.m.Y') }}</p>
@if ($draft ?? false)
<h1>Angebot und Mietvertrag (Entwurf)</h1>
<p class="muted">Angebot {{ $booking->reference }} · Version {{ $booking->offer_version }} · erstellt am {{ ($booking->offer_sent_at ?? now())->format('d.m.Y') }} · gültig bis {{ $booking->hold_expires_at?->format('d.m.Y, H:i') }} Uhr</p>
<p><strong>{{ \App\Support\Content::get('offer.contract_note') }}</strong></p>
@else
<h1>Mietvertrag Ferienwohnung</h1>
<p class="muted">Buchungsnummer {{ $booking->reference }} · ausgestellt am {{ ($booking->confirmed_at ?? now())->format('d.m.Y') }}@if ($booking->accepted_at) · Angebot angenommen am {{ $booking->accepted_at->format('d.m.Y, H:i') }} Uhr @endif</p>
@endif
<p>{{ \App\Support\Content::get('contract.intro') }}</p>
+6 -1
View File
@@ -35,5 +35,10 @@
Schedule::call(fn (AnonymizeGuests $anonymizeGuests) => $anonymizeGuests->handle())
->name('guests:anonymize')
->monthlyOn(1, '03:00')
->dailyAt('03:00')
->withoutOverlapping();
Schedule::command('backup:database')
->name('backup:database')
->dailyAt('02:30')
->withoutOverlapping();
+6 -1
View File
@@ -2,15 +2,20 @@
use App\Http\Controllers\ChannelController;
use App\Http\Controllers\MarketingConsentController;
use App\Http\Controllers\OfferController;
use App\Http\Controllers\PageController;
use App\Models\Booking;
use Illuminate\Foundation\Http\Middleware\PreventRequestForgery;
use Illuminate\Support\Facades\Route;
Route::middleware('signed')->group(function () {
Route::get('/bewertung/{booking}', fn (Booking $booking) => view('review', ['booking' => $booking]))->name('reviews.create');
Route::get('/bewertung/{booking}', fn (Booking $booking) => view('review', ['booking' => $booking]))->name('reviews.create')->middleware('throttle:30,1');
Route::get('/angebote/bestaetigen/{guest}', [MarketingConsentController::class, 'confirm'])->name('marketing.confirm');
Route::get('/angebote/abmelden/{guest}', [MarketingConsentController::class, 'unsubscribe'])->name('marketing.unsubscribe');
// Booking path 1: the guest's offer page (docs/KONZEPT.md §6a)
Route::get('/angebot/{booking}', [OfferController::class, 'show'])->name('offers.show')->middleware('throttle:30,1');
Route::post('/angebot/{booking}/annehmen', [OfferController::class, 'accept'])->name('offers.accept')->middleware('throttle:10,1');
Route::post('/angebot/{booking}/ablehnen', [OfferController::class, 'reject'])->name('offers.reject')->middleware('throttle:10,1');
});
Route::get('/kalender/{token}.ics', [ChannelController::class, 'feed'])->name('channels.feed')->middleware('throttle:60,1');
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
#
# Fetches a fresh backup from the server to a local folder (e.g. the NAS) – nothing is changed on the server
# except creating the new database dump.
#
# scripts/backup-pull.sh <environment> <target folder>
#
# Copies: the newest database dump (backup:database) and the uploaded files (photos, contracts) from shared/storage/app.
# Uses the same settings as scripts/deploy.sh (scripts/deploy.<environment>.env).
set -euo pipefail
ENVIRONMENT="${1:?Umgebung angeben, z. B. production}"
TARGET="${2:?Zielordner angeben, z. B. /volume1/backup/fewo}"
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
# shellcheck source=/dev/null
source "$ROOT/scripts/deploy.$ENVIRONMENT.env"
DEPLOY_SSH_KEY="${DEPLOY_SSH_KEY/#\~/$HOME}"
SSH=(ssh -p "${DEPLOY_PORT:-22}" -o BatchMode=yes ${DEPLOY_SSH_KEY:+-i "$DEPLOY_SSH_KEY"} "${DEPLOY_USER:+$DEPLOY_USER@}$DEPLOY_HOST")
STAMP="$(date +%Y%m%d-%H%M%S)"
mkdir -p "$TARGET/$STAMP"
echo "▶ Datenbank sichern"
"${SSH[@]}" "cd '$DEPLOY_PATH/current' && '${DEPLOY_PHP:-/opt/RZphp84/bin/php-cli}' artisan backup:database --no-interaction"
LATEST="$("${SSH[@]}" "ls -1 '$DEPLOY_PATH/shared/storage/app/private/backups/' | sort | tail -n 1")"
"${SSH[@]}" "cat '$DEPLOY_PATH/shared/storage/app/private/backups/$LATEST'" > "$TARGET/$STAMP/$LATEST"
echo "▶ Dateien sichern (Fotos, Verträge)"
"${SSH[@]}" "tar -czf - -C '$DEPLOY_PATH/shared/storage/app' --exclude='private/backups' ." > "$TARGET/$STAMP/files.tar.gz"
echo "✓ Gesichert nach $TARGET/$STAMP ($(du -sh "$TARGET/$STAMP" | cut -f1))"
Binary file not shown.

After

Width:  |  Height:  |  Size: 662 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 KiB

+191
View File
@@ -0,0 +1,191 @@
<?php
namespace Tests\Feature;
use App\Actions\ExpireReservations;
use App\Actions\SendOffer;
use App\Availability\AvailabilityChecker;
use App\Enums\BookingStatus;
use App\Enums\QuoteLineType;
use App\Filament\Resources\Bookings\Pages\ViewBooking;
use App\Mail\BookingConfirmed;
use App\Mail\OfferAnswered;
use App\Mail\OfferMade;
use App\Models\Booking;
use App\Models\Property;
use App\Models\SpecialOffer;
use App\Models\User;
use Carbon\CarbonImmutable;
use Database\Seeders\PropertySeeder;
use Database\Seeders\SiteSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\URL;
use Livewire\Livewire;
use Tests\TestCase;
class OfferWorkflowTest extends TestCase
{
use RefreshDatabase;
private Property $property;
private Booking $booking;
protected function setUp(): void
{
parent::setUp();
$this->travelTo(CarbonImmutable::parse('2026-10-22 10:00'));
$this->seed([PropertySeeder::class, SiteSeeder::class]);
$this->property = Property::sole();
Mail::fake();
Storage::fake('local');
$this->withoutVite();
$this->booking = Booking::factory()->for($this->property)->reserved(now()->addHours(48))->create([
'arrival' => '2026-11-07',
'departure' => '2026-11-10',
'guests' => 2,
]);
}
public function test_offer_recalculates_the_price_with_adjustment_and_promo_code_and_updates_the_guest(): void
{
SpecialOffer::factory()->for($this->property)->create(['name' => 'Stammgast', 'code' => 'OSTSEE', 'discount_value' => 10]);
$offer = app(SendOffer::class)->handle($this->booking, [
'departure' => '2026-11-11',
'promo_code' => 'ostsee',
'price_adjustment' => -2000,
'price_adjustment_label' => 'Nachlass für Wiederkehrer',
'valid_until' => '2026-10-25 18:00',
'offer_message' => 'Wir freuen uns auf Sie!',
'guest' => ['first_name' => 'Erika', 'last_name' => 'Musterfrau', 'street' => 'Seeweg 1', 'postal_code' => '18225', 'city' => 'Kühlungsborn'],
]);
$lines = collect($offer->quote['lines']);
$this->assertSame(BookingStatus::OfferSent, $offer->status);
$this->assertSame([1, '2026-11-11', 'ostsee', -2000], [$offer->offer_version, $offer->departure->toDateString(), $offer->promo_code, $offer->price_adjustment]);
$this->assertSame('2026-10-25 18:00', $offer->hold_expires_at->format('Y-m-d H:i'));
$this->assertTrue($lines->contains(fn (array $line): bool => $line['label'] === 'Stammgast' && $line['amount'] < 0));
$this->assertTrue($lines->contains(fn (array $line): bool => $line['type'] === QuoteLineType::Adjustment->value && $line['amount'] === -2000 && $line['label'] === 'Nachlass für Wiederkehrer'));
$this->assertSame($lines->sum('amount'), $offer->total);
$this->assertSame(['Erika', 'Kühlungsborn'], [$offer->guest->first_name, $offer->guest->city]);
Storage::disk('local')->assertExists($offer->offer_path);
Mail::assertSent(OfferMade::class, fn (OfferMade $mail): bool => $mail->hasTo($offer->guest->email) && str_contains($mail->offerUrl, 'signature='));
}
public function test_guest_accepts_the_offer_and_the_booking_becomes_binding(): void
{
$url = $this->sendOffer();
$this->get($url)->assertOk()->assertSee('Angebot zahlungspflichtig annehmen')->assertSee('Gesamtpreis')->assertSee('Gesamtbetrag');
$acceptUrl = $this->formAction($url, 'annehmen');
$this->post($acceptUrl, [])->assertSessionHasErrors('terms');
$this->followingRedirects()->post($acceptUrl, ['terms' => '1'])->assertOk()->assertSee('Ihre Buchung ist verbindlich');
$booking = $this->booking->fresh();
$this->assertSame(BookingStatus::Confirmed, $booking->status);
$this->assertNotNull($booking->accepted_at);
$this->assertSame(1, $booking->acceptance['offer_version']);
$this->assertSame($booking->total, $booking->acceptance['total']);
Storage::disk('local')->assertExists($booking->contract_path);
Mail::assertSent(BookingConfirmed::class);
Mail::assertSent(OfferAnswered::class, fn (OfferAnswered $mail): bool => $mail->accepted);
$html = $this->get($url)->getContent();
preg_match('~<main.*</main>~s', $html, $m);
dump(strip_tags($m[0] ?? substr($html, 0, 3000)));
}
public function test_link_of_an_older_offer_version_cannot_be_used(): void
{
$oldUrl = $this->sendOffer();
$this->sendOffer();
$this->get($oldUrl)->assertOk()->assertSee('aktualisiertes Angebot')->assertDontSee('Angebot zahlungspflichtig annehmen');
$this->post(URL::temporarySignedRoute('offers.accept', now()->addDay(), ['booking' => $this->booking, 'v' => 1]), ['terms' => '1']);
$this->assertSame(BookingStatus::OfferSent, $this->booking->fresh()->status);
}
public function test_offer_holds_the_dates_until_it_expires(): void
{
$url = $this->sendOffer(['valid_until' => '2026-10-24 10:00']);
$availability = new AvailabilityChecker;
$this->assertFalse($availability->isAvailable($this->property, $this->booking->arrival, $this->booking->departure));
$this->travelTo(CarbonImmutable::parse('2026-10-24 11:00'));
$this->assertTrue($availability->isAvailable($this->property, $this->booking->arrival, $this->booking->departure));
$this->assertSame(1, app(ExpireReservations::class)->handle());
$this->assertSame(BookingStatus::Expired, $this->booking->fresh()->status);
$this->get($url)->assertForbidden();
}
public function test_guest_declines_the_offer(): void
{
$url = $this->sendOffer();
$this->post($this->formAction($url, 'ablehnen'))->assertRedirect();
$booking = $this->booking->fresh();
$this->assertSame([BookingStatus::Declined, 'guest'], [$booking->status, $booking->declined_by]);
$this->assertTrue((new AvailabilityChecker)->isAvailable($this->property, $booking->arrival, $booking->departure));
Mail::assertSent(OfferAnswered::class, fn (OfferAnswered $mail): bool => ! $mail->accepted);
}
public function test_offer_page_needs_a_valid_signature(): void
{
$this->sendOffer();
$this->get('/angebot/'.$this->booking->id.'?v=1')->assertForbidden();
$this->post('/angebot/'.$this->booking->id.'/annehmen?v=1', ['terms' => '1'])->assertForbidden();
}
public function test_landlord_sends_the_offer_from_the_booking_page(): void
{
$this->actingAs(User::factory()->create());
Livewire::test(ViewBooking::class, ['record' => $this->booking->getRouteKey()])
->callAction('sendOffer', [
'arrival' => '2026-11-07',
'departure' => '2026-11-10',
'guests' => 2,
'price_adjustment' => '-25.50',
'price_adjustment_label' => 'Sonderpreis',
'valid_until' => '2026-10-26 12:00',
'guest' => ['first_name' => 'Max', 'last_name' => 'Muster'],
])
->assertHasNoFormErrors()
->assertNotified('Angebot gesendet');
$this->assertSame([BookingStatus::OfferSent, -2550], [$this->booking->fresh()->status, $this->booking->fresh()->price_adjustment]);
Mail::assertSent(OfferMade::class);
}
/**
* @param array<string, mixed> $changes
*/
private function sendOffer(array $changes = []): string
{
$send = app(SendOffer::class);
$booking = $send->handle($this->booking->fresh(), $changes);
return $send->offerUrl($booking);
}
/**
* The signed form action of the offer page ("annehmen" or "ablehnen").
*/
private function formAction(string $pageUrl, string $action): string
{
preg_match('~action="([^"]*/'.$action.'[^"]*)"~', $this->get($pageUrl)->getContent(), $match);
$this->assertNotEmpty($match, "form for {$action} not found");
return html_entity_decode($match[1]);
}
}
+139
View File
@@ -0,0 +1,139 @@
<?php
namespace Tests\Feature;
use App\Actions\AnonymizeGuests;
use App\Actions\CreateReservation;
use App\Enums\BookingStatus;
use App\Enums\PortalEmailStatus;
use App\Enums\PortalEmailType;
use App\Models\Booking;
use App\Models\Channel;
use App\Models\Guest;
use App\Models\Photo;
use App\Models\PortalEmail;
use App\Models\Property;
use App\Models\Review;
use App\Pricing\StayRequest;
use Carbon\CarbonImmutable;
use Database\Seeders\PropertySeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Storage;
use Tests\TestCase;
class PrivacyHardeningTest extends TestCase
{
use RefreshDatabase;
protected function setUp(): void
{
parent::setUp();
$this->travelTo(CarbonImmutable::parse('2026-10-22 10:00'));
Mail::fake();
}
public function test_anonymisation_also_removes_notes_attribution_and_review_details(): void
{
$booking = Booking::factory()->create(['internal_notes' => 'ruft abends an', 'utm_source' => 'newsletter', 'offer_message' => 'Hallo Frau Muster']);
$review = Review::factory()->create(['booking_id' => $booking->id, 'display_name' => 'Erika M.', 'private_feedback' => 'Nachbar laut']);
$booking->guest->anonymize();
$booking->refresh();
$this->assertSame([null, null, null], [$booking->internal_notes, $booking->utm_source, $booking->offer_message]);
$this->assertSame(['Gast', null], [$review->fresh()->display_name, $review->fresh()->private_feedback]);
}
public function test_guests_with_only_unbinding_requests_are_anonymised_after_the_inquiry_period(): void
{
$inquiry = Booking::factory()->create(['status' => BookingStatus::Expired, 'confirmed_at' => null]);
$customer = Booking::factory()->create(['status' => BookingStatus::Completed, 'confirmed_at' => now()]);
Guest::query()->update(['updated_at' => now()]);
Booking::query()->update(['updated_at' => now()]);
$this->travel(7)->months();
app(AnonymizeGuests::class)->handle();
$this->assertNotNull($inquiry->guest->fresh()->anonymized_at);
$this->assertNull($customer->guest->fresh()->anonymized_at);
}
public function test_portal_mail_excerpts_and_old_attribution_are_removed_after_their_periods(): void
{
$mail = PortalEmail::query()->create(['channel_id' => Channel::factory()->create()->id, 'message_id' => 'x@portal', 'from' => 'noreply@portal.example', 'subject' => 'Neue Buchung', 'received_at' => now(), 'type' => PortalEmailType::Booking, 'status' => PortalEmailStatus::Blocked, 'excerpt' => 'Gast: Erika Musterfrau']);
$booking = Booking::factory()->create(['utm_source' => 'instagram', 'referral_source' => null]);
$this->travel(100)->days();
app(AnonymizeGuests::class)->handle();
$this->assertNull($mail->fresh()->excerpt);
$this->assertSame('instagram', $booking->fresh()->utm_source);
$this->travel(2)->years();
app(AnonymizeGuests::class)->handle();
$this->assertNull($booking->fresh()->utm_source);
}
public function test_request_with_a_known_email_does_not_overwrite_the_guest_file(): void
{
$this->seed(PropertySeeder::class);
$guest = Guest::factory()->create(['email' => 'erika@example.com', 'first_name' => 'Erika', 'last_name' => 'Muster', 'city' => 'Rostock', 'phone' => null]);
$booking = app(CreateReservation::class)->handle(
Property::sole(),
new StayRequest(CarbonImmutable::parse('2026-11-07'), CarbonImmutable::parse('2026-11-10'), 2),
['first_name' => 'Erika', 'last_name' => 'Muster', 'email' => 'Erika@Example.com', 'city' => 'Berlin', 'phone' => '0170 1'],
sendMails: false,
);
$guest->refresh();
$this->assertSame($guest->id, $booking->guest_id);
$this->assertSame(['Rostock', '0170 1'], [$guest->city, $guest->phone], 'existing data stays, empty fields are completed');
$this->assertStringContainsString('Ort: Berlin (Kartei: Rostock)', $booking->internal_notes);
}
public function test_automation_tokens_are_accepted_as_bearer_header(): void
{
config(['fewo.scheduler_token' => 'geheim']);
$this->get('/automation/scheduler', ['Authorization' => 'Bearer geheim'])->assertOk();
$this->get('/automation/scheduler', ['Authorization' => 'Bearer falsch'])->assertNotFound();
}
public function test_responses_carry_security_headers(): void
{
$this->get('/up')
->assertHeader('X-Content-Type-Options', 'nosniff')
->assertHeader('X-Frame-Options', 'SAMEORIGIN')
->assertHeader('Referrer-Policy', 'strict-origin-when-cross-origin');
}
public function test_uploaded_photo_originals_are_stripped_of_metadata(): void
{
Storage::fake('public');
$photo = Photo::factory()->create();
$media = $photo->addMedia(UploadedFile::fake()->image('drohne.jpg', 1200, 800))->toMediaCollection(Photo::COLLECTION);
$this->assertTrue($media->fresh()->getCustomProperty('metadata_stripped'));
$this->artisan('photos:strip-metadata')->expectsOutputToContain('0 Original-Foto(s) bereinigt.')->assertSuccessful();
}
public function test_database_backup_is_written_and_rotated(): void
{
Storage::fake('local');
Guest::factory()->create(['last_name' => "O'Brien"]);
$this->artisan('backup:database', ['--keep' => 1])->assertSuccessful();
$this->travel(1)->minutes();
$this->artisan('backup:database', ['--keep' => 1])->assertSuccessful();
$files = Storage::disk('local')->files('backups');
$this->assertCount(1, $files);
$dump = gzdecode(Storage::disk('local')->get($files[0]));
$this->assertStringContainsString('CREATE TABLE "guests"', $dump);
$this->assertStringContainsString("O''Brien", $dump);
}
}
@@ -31,11 +31,12 @@ public function test_admin_with_two_factor_enters_the_admin(): void
$this->get(BookingResource::getUrl('index'))->assertOk();
}
public function test_other_roles_may_work_without_two_factor(): void
public function test_every_role_must_set_up_two_factor(): void
{
$this->actingAs(User::factory()->role(UserRole::Rentals)->withoutTwoFactor()->create());
$this->get(BookingResource::getUrl('index'))->assertOk();
$this->get(BookingResource::getUrl('index'))
->assertRedirect(Filament::getPanel('admin')->getSetUpRequiredMultiFactorAuthenticationUrl());
}
public function test_two_factor_secret_is_stored_encrypted(): void