Beiträge mit dem Baukasten der Seiten, Galerie-Großansicht mit Blättern
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m42s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 4m3s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m32s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m9s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m41s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 6m5s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m57s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 4m59s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m35s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-26 19:43:05 +00:00
parent 3b72b5327e
commit bdd21a38cb
164 changed files with 1276 additions and 623 deletions

View file

@ -16,7 +16,7 @@ use Inhaus\Plugins\News\Database\Factories\NewsPostFactory;
#[Fillable([
'category_id', 'author_id', 'title', 'slug', 'teaser', 'body',
'cover_path', 'is_featured', 'published_at', 'form_id',
'cover_path', 'is_featured', 'published_at', 'form_id', 'content',
])]
class NewsPost extends Model
{
@ -78,6 +78,7 @@ class NewsPost extends Model
{
return [
'is_featured' => 'boolean',
'content' => 'array',
'published_at' => 'datetime',
'submitted_at' => 'datetime',
'form_id' => 'integer',
@ -138,6 +139,20 @@ class NewsPost extends Model
};
}
/**
* Inhalt als Pagebuilder-Blöcke – ältere Beiträge (nur „body“) als ein Textblock.
*
* @return array{blocks: list<array<string, mixed>>}
*/
public function blocks(): array
{
if (is_array($this->content)) {
return $this->content;
}
return ['blocks' => filled($this->body) ? [['type' => 'text', 'data' => ['html' => $this->body_html ?? $this->body]]] : []];
}
public function coverUrl(string $variant = 'large'): ?string
{
return app(Images::class)->url($this->cover_path, $variant);