- 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>
36 lines
1.2 KiB
PHP
36 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Actions\SyncChannel;
|
|
use App\Models\Channel;
|
|
use Illuminate\Console\Attributes\Description;
|
|
use Illuminate\Console\Attributes\Signature;
|
|
use Illuminate\Console\Command;
|
|
|
|
#[Signature('channels:sync {channel? : ID of a single channel}')]
|
|
#[Description('Import the occupations of all active portals (or one) and report conflicts')]
|
|
class SyncChannels extends Command
|
|
{
|
|
/**
|
|
* Execute the console command.
|
|
*/
|
|
public function handle(SyncChannel $syncChannel): int
|
|
{
|
|
$channels = Channel::query()->active()
|
|
->when($this->argument('channel'), fn ($query, $id) => $query->whereKey($id))
|
|
->get()
|
|
->filter(fn (Channel $channel): bool => $channel->importsOccupations());
|
|
|
|
foreach ($channels as $channel) {
|
|
$log = $syncChannel->handle($channel);
|
|
|
|
$log->successful
|
|
? $this->info("✓ {$channel->name}: {$log->events} Belegungen, +{$log->added} ~{$log->changed} -{$log->removed}, Konflikte: {$log->conflicts}")
|
|
: $this->error("✗ {$channel->name}: {$log->message}");
|
|
}
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
}
|