Lege das Datenmodell und den Anfrageservice der Kommunikationsverwaltung an

Anliegen, Feldkatalog, Feldgruppen, Anfragevorlagen mit unveränderlichen Fassungen,
Anfrage-Einstiege und eingegangene Anfragen. Eine gemeinsame Regelauswertung bedient
Besucher, Vorschau und Anfrageservice; Werte nicht mehr relevanter Felder werden verworfen,
Anliegen und Auswahlwerte serverseitig geprüft, doppeltes Absenden bleibt eine Anfrage.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-11-27 17:26:42 +01:00
1 parent 9e2d64a4a9
commit 2ee1fc9866
30 files changed
+3380

No files matched your search

+53
View File
@@ -0,0 +1,53 @@
<?php
namespace App\Jobs;
use App\Domain\Communication\CommunicationSettings;
use App\Domain\Communication\Inquiry;
use App\Mail\InquiryReceived;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Str;
use Throwable;
/**
* Interne Benachrichtigung über eine neue Anfrage. Die Anfrage ist zu diesem Zeitpunkt bereits gespeichert; ein Fehler
* hier wird an der Anfrage vermerkt (notification_error), geht nie verloren und lässt sich in der Verwaltung wiederholen.
*/
class SendInquiryNotification implements ShouldQueue
{
use Queueable;
public int $tries = 1;
public function __construct(public int $inquiryId) {}
public function handle(): void
{
$inquiry = Inquiry::query()->find($this->inquiryId);
if ($inquiry === null) {
return;
}
$recipients = CommunicationSettings::current()->recipientList();
if ($recipients === []) {
$inquiry->forceFill(['notification_error' => 'Es sind keine Empfänger für Benachrichtigungen hinterlegt (Kommunikation → Einstellungen).'])->save();
return;
}
try {
Mail::to($recipients)->send(new InquiryReceived($inquiry));
} catch (Throwable $e) {
report($e);
$inquiry->forceFill(['notification_error' => 'Der E-Mail-Versand ist fehlgeschlagen: '.Str::limit($e->getMessage(), 400)])->save();
return;
}
$inquiry->forceFill(['notified_at' => now(), 'notification_error' => null])->save();
}
}