- Gäste: Markierungen, Aufenthalte & Umsatz, Stammgast-/Einwilligungsfilter, CSV-Export, Anonymisierung (manuell + automatisch nach Aufbewahrungsfrist) - Werbe-Einwilligung per Double-Opt-in aus dem Anfrageformular, signierte Bestätigungs-/Abmeldelinks - Bewertungen: automatische Einladung nach Abreise, Bewertungsformular mit Kategorien und internem Feedback, Freigabe und öffentliche Antwort im Admin - Konzept: Rollen, Inhalte, Customer Voice, Architektur Portal-Sync/Buchungshoheit Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
27 lines
639 B
PHP
27 lines
639 B
PHP
<?php
|
|
|
|
namespace App\Actions;
|
|
|
|
use App\Models\Guest;
|
|
|
|
/**
|
|
* Anonymises guests whose last stay ended longer ago than the retention period (GDPR storage limitation).
|
|
*/
|
|
class AnonymizeGuests
|
|
{
|
|
public function handle(): int
|
|
{
|
|
$cutoff = today()->subYears(config('fewo.guest_retention_years'));
|
|
|
|
$guests = Guest::query()
|
|
->whereNull('anonymized_at')
|
|
->whereDate('created_at', '<', $cutoff)
|
|
->whereDoesntHave('bookings', fn ($query) => $query->whereDate('departure', '>=', $cutoff))
|
|
->get();
|
|
|
|
$guests->each->anonymize();
|
|
|
|
return $guests->count();
|
|
}
|
|
}
|