Files
fewo-stommer/app/Actions/MonitorChannels.php
T
Lars StommerandClaude Opus 5.5 0b7205e050 Portal-Synchronisation: unser System führt
- Connector-System (app/Channels, config/channels.php) mit iCal-Connector, robustem Parser und Export-Feed je Portal (ohne eigene Belegungen, ohne Gästedaten)
- Abgleich alle 5 Min. mit Protokoll, Echo-Erkennung, Konflikt-Mail bei möglicher Doppelbuchung
- Überwachung: Störungs-Mail, Status-Endpunkt /health/sync für n8n
- Portal-Aufgaben für Sofortbuchungsportale (FeWo-direkt): automatisch aus Buchungen/Sperren/anderen Portalen, Mail + Erinnerung, Abhaken im Admin
- Optionaler signierter Automatisierungs-Webhook mit Rückmeldung
- Herkunftsmessung: Abfrage im Formular + UTM-Parameter
- Portal-Analyse: AGB-Prüfung Automatisierung, Umsetzungsbeschreibung

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 11:13:55 +02:00

28 lines
761 B
PHP

<?php
namespace App\Actions;
use App\Mail\ChannelSyncAlert;
use App\Models\Channel;
use Illuminate\Support\Facades\Mail;
/**
* Alerts the landlord once per incident when a portal import fails or has not succeeded for too long.
* The alert is reset by the next successful sync.
*/
class MonitorChannels
{
public function handle(): int
{
$channels = Channel::query()->active()->whereNull('alerted_at')->get()
->filter(fn (Channel $channel): bool => $channel->isStale());
foreach ($channels as $channel) {
Mail::to(config('fewo.notification_email'))->send(new ChannelSyncAlert($channel));
$channel->forceFill(['alerted_at' => now()])->save();
}
return $channels->count();
}
}