🆙 More fixes 🆙

This commit is contained in:
Remco
2026-01-19 21:09:07 +01:00
parent 19269de238
commit c63995a6d5
2 changed files with 17 additions and 17 deletions
+16 -16
View File
@@ -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 [