'array', 'status' => InquiryStatus::class, 'notified_at' => 'datetime']; } public function entry(): BelongsTo { return $this->belongsTo(InquiryEntry::class, 'entry_id'); } public function templateVersion(): BelongsTo { return $this->belongsTo(InquiryTemplateVersion::class, 'template_version_id'); } public function notes(): HasMany { return $this->hasMany(InquiryNote::class)->orderByDesc('created_at')->orderByDesc('id'); } /** Lesbare Bezeichnung des Anliegens, mit Unteranliegen. */ public function issueTitle(): string { return trim(implode(' › ', array_filter([$this->issue_label, $this->subissue_label]))); } /** * Woher die Anfrage kam: der Anfrage-Einstieg (älterer Weg) oder das Formular, das das Widget „Anfrage“ eingebunden hat. */ public function channelTitle(): string { if ($this->entry !== null) { return $this->entry->name; } $template = $this->templateVersion?->template; return $template !== null ? 'Formular „'.$template->name.'“' : 'Formular gelöscht'; } public function contactTitle(): string { return $this->contact_name ?: ($this->contact_email ?: 'Unbekannt'); } }