'array', 'published_config' => 'array', 'published_at' => 'datetime', 'archived_at' => 'datetime']; } public function template(): BelongsTo { return $this->belongsTo(InquiryTemplate::class, 'template_id'); } public function inquiries(): HasMany { return $this->hasMany(Inquiry::class, 'entry_id'); } /** Einstiege, die Besuchern ausgeliefert werden können (Vorlage zusätzlich in isLive() prüfen). */ public function scopeLive(Builder $query): Builder { return $query->whereNotNull('published_at')->whereNull('archived_at')->whereNotNull('published_config'); } public function isLive(): bool { return $this->published_at !== null && $this->archived_at === null && $this->published_config !== null && $this->template?->published_version_id !== null && $this->template->archived_at === null; } public function hasUnpublishedChanges(): bool { return $this->published_config === null || FormJson::normalize($this->published_config) !== FormJson::normalize((array) $this->config); } /** * @return array */ public static function emptyConfig(): array { return [ 'mode' => 'compact', 'open' => 'inline', 'allowed_issues' => [], 'allowed_subissues' => [], 'defaults' => [], 'texts' => [], ]; } }