From c63995a6d5539f6e8183b5a420a764cc6e44bd4e Mon Sep 17 00:00:00 2001 From: Remco Date: Mon, 19 Jan 2026 21:09:07 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=86=99=20More=20fixes=20=F0=9F=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Updated_Cms/app/Models/Article.php | 32 +++++++++---------- .../Articles/WebsiteArticleReaction.php | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Updated_Cms/app/Models/Article.php b/Updated_Cms/app/Models/Article.php index 8f2a2a23f9..bc5b89ef40 100644 --- a/Updated_Cms/app/Models/Article.php +++ b/Updated_Cms/app/Models/Article.php @@ -102,12 +102,12 @@ class Article extends Model public function comments(): HasMany { - return $this->hasMany(ArticleComment::class); + return $this->hasMany(ArticleComment::class)->defaultBehavior(); } public function reactions(): HasMany { - return $this->hasMany(ArticleReaction::class); + return $this->hasMany(ArticleReaction::class)->defaultBehavior(); } public function user() @@ -115,25 +115,25 @@ class Article extends Model return $this->belongsTo(User::class); } - public function tags() + public function tags(): \Illuminate\Database\Eloquent\Relations\MorphToMany { return $this->morphToMany(Tag::class, 'taggable'); } - protected function titleColor(): Attribute - { - return new Attribute( - get: fn () => isDarkColor($this->predominant_color) ? '#fff' : '#000', - ); - } + // protected function titleColor(): Attribute + // { + // return new Attribute( + // get: fn () => isDarkColor($this->predominant_color) ? '#fff' : '#000', + // ); + // } - public function createFollowersNotification(): void - { - $this->user->followers() - ->with('user:id,username') - ->each(fn (AuthorNotification $follower) => $follower->user->notify($this->user, NotificationType::ArticlePosted, $this->getNotificationUrl()), - ); - } + // public function createFollowersNotification(): void + // { + // $this->user->followers() + // ->with('user:id,username') + // ->each(fn (AuthorNotification $follower) => $follower->user->notify($this->user, NotificationType::ArticlePosted, $this->getNotificationUrl()), + // ); + // } protected function casts(): array { return [ diff --git a/Updated_Cms/app/Models/Articles/WebsiteArticleReaction.php b/Updated_Cms/app/Models/Articles/WebsiteArticleReaction.php index 7b3077b8aa..479a6169f4 100644 --- a/Updated_Cms/app/Models/Articles/WebsiteArticleReaction.php +++ b/Updated_Cms/app/Models/Articles/WebsiteArticleReaction.php @@ -32,7 +32,7 @@ class WebsiteArticleReaction extends Model static::creating(function ($model): void { /** @var WebsiteArticleReaction $model */ - $model->user_id = (int) (auth()->id() ?? 0); + $model->user_id = max(0, (int) (auth()->id() ?? 0)); }); }