Files
LarsandClaude Opus 5.5 1c757f7429 Erinnerungsabstand und taegliche/woechentliche Zusammenfassung einstellbar
System > Betrieb > Benachrichtigungen: offene Meldungen (Doppelbuchungen im
Postfach, Portal-Aufgaben) nur einmal oder alle 1/2/3/7 Tage erneut senden;
Tages- und/oder Wochenuebersicht mit waehlbarer Uhrzeit, Wochentag und Inhalt
(Postfach, Anfragen, Neues, An-/Abreisen, Zahlungen, Portale, Bewertungen).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 10:11:15 +01:00

71 lines
1.9 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Models;
use App\Enums\InboxMessageKind;
use App\Models\Concerns\BelongsToTenant;
use Database\Factories\InboxMessageFactory;
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 message in the admin inbox ("Postfach"). The fingerprint identifies the finding, so the same
* finding is posted – and e-mailed – only once per landlord (App\Support\Inbox).
*/
#[Fillable(['property_id', 'channel_id', 'kind', 'fingerprint', 'subject', 'body', 'action_url', 'notified_at', 'last_seen_at', 'read_at'])]
class InboxMessage extends Model
{
/** @use HasFactory<InboxMessageFactory> */
use BelongsToTenant, HasFactory;
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'kind' => InboxMessageKind::class,
'notified_at' => 'immutable_datetime',
'last_seen_at' => 'immutable_datetime',
'read_at' => 'immutable_datetime',
];
}
/**
* @return BelongsTo<Property, $this>
*/
public function property(): BelongsTo
{
return $this->belongsTo(Property::class);
}
/**
* @return BelongsTo<Channel, $this>
*/
public function channel(): BelongsTo
{
return $this->belongsTo(Channel::class);
}
public function isRead(): bool
{
return $this->read_at !== null;
}
/**
* @param Builder<InboxMessage> $query
* @return Builder<InboxMessage>
*/
#[Scope]
protected function unread(Builder $query): Builder
{
return $query->whereNull('read_at');
}
}