Kommentare mit Antworten unter Neuigkeiten
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 4m42s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 4m33s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 5m41s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 5m48s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 8m0s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 8m6s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 5m10s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 5m19s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m21s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-26 20:13:41 +00:00
parent f3f2d23961
commit 9320d602a8
117 changed files with 1015 additions and 423 deletions

View file

@ -11,12 +11,13 @@ use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Str;
use Inhaus\Plugins\News\Database\Factories\NewsPostFactory;
#[Fillable([
'category_id', 'author_id', 'title', 'slug', 'teaser', 'body',
'cover_path', 'is_featured', 'published_at', 'form_id', 'content',
'cover_path', 'is_featured', 'published_at', 'form_id', 'content', 'comments_enabled',
])]
class NewsPost extends Model
{
@ -79,6 +80,7 @@ class NewsPost extends Model
return [
'is_featured' => 'boolean',
'content' => 'array',
'comments_enabled' => 'boolean',
'published_at' => 'datetime',
'submitted_at' => 'datetime',
'form_id' => 'integer',
@ -153,6 +155,12 @@ class NewsPost extends Model
return ['blocks' => filled($this->body) ? [['type' => 'text', 'data' => ['html' => $this->body_html ?? $this->body]]] : []];
}
/** @return HasMany<NewsComment, $this> */
public function comments(): HasMany
{
return $this->hasMany(NewsComment::class, 'post_id');
}
public function coverUrl(string $variant = 'large'): ?string
{
return app(Images::class)->url($this->cover_path, $variant);