medal valid forever text

This commit is contained in:
xiaomlove
2023-01-21 13:58:35 +08:00
parent 19be90c207
commit 3762c15dc7
3 changed files with 10 additions and 2 deletions

View File

@@ -39,6 +39,14 @@ class Medal extends NexusModel
return nexus_trans("medal.get_types." . $this->get_type);
}
public function getDurationTextAttribute($value): string
{
if ($this->duration > 0) {
return $this->duration;
}
return nexus_trans("label.permanent");
}
public function users(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
{
return $this->belongsToMany(User::class, 'user_medals', 'medal_id', 'uid')->withTimestamps();