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>
This commit is contained in:
1 parent
a8e72715ab
commit
0b7205e050
55 files changed
+2290
-3
No files matched your search
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\ChannelTaskAction;
|
||||
use App\Enums\ChannelTaskStatus;
|
||||
use Database\Factories\ChannelTaskFactory;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Attributes\Scope;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* A change that has to be made by hand (or by an external automation) on a portal that
|
||||
* cannot be kept in sync fast enough by calendar feeds, e.g. because of instant booking.
|
||||
*/
|
||||
#[Fillable(['channel_id', 'action', 'starts_on', 'ends_on', 'reason', 'status', 'completed_by', 'completed_at', 'reminded_at', 'automation_sent_at', 'automation_error'])]
|
||||
class ChannelTask extends Model
|
||||
{
|
||||
/** @use HasFactory<ChannelTaskFactory> */
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'action' => ChannelTaskAction::class,
|
||||
'status' => ChannelTaskStatus::class,
|
||||
'starts_on' => 'immutable_date',
|
||||
'ends_on' => 'immutable_date',
|
||||
'completed_at' => 'immutable_datetime',
|
||||
'reminded_at' => 'immutable_datetime',
|
||||
'automation_sent_at' => 'immutable_datetime',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<Channel, $this>
|
||||
*/
|
||||
public function channel(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Channel::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Builder<ChannelTask> $query
|
||||
* @return Builder<ChannelTask>
|
||||
*/
|
||||
#[Scope]
|
||||
protected function open(Builder $query): Builder
|
||||
{
|
||||
return $query->where('status', ChannelTaskStatus::Open);
|
||||
}
|
||||
|
||||
public function complete(string $completedBy): void
|
||||
{
|
||||
$this->update([
|
||||
'status' => ChannelTaskStatus::Done,
|
||||
'completed_by' => $completedBy,
|
||||
'completed_at' => now(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Human readable period, e.g. "14.06.2027 – 21.06.2027".
|
||||
*/
|
||||
public function period(): string
|
||||
{
|
||||
return $this->starts_on->format('d.m.Y').' – '.$this->ends_on->format('d.m.Y');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user