topic_reply & hr_reached notification configurable

This commit is contained in:
xiaomlove
2022-11-25 21:04:27 +08:00
parent af67dd868b
commit e9d1f080c0
9 changed files with 130 additions and 61 deletions

View File

@@ -102,6 +102,7 @@ class User extends Authenticatable implements FilamentUser, HasName
'invites' => '邀请',
];
public static array $notificationOptions = ['topic_reply', 'hr_reached'];
public function getClassTextAttribute(): string
{
@@ -555,6 +556,14 @@ class User extends Authenticatable implements FilamentUser, HasName
return false;
}
public function acceptNotification($name): bool
{
if (!isset($this->original['notifs'])) {
throw new \RuntimeException("Not fetch field: notifs");
}
return str_contains($this->notifs, "[{$name}]");
}