show rainbow ID in userdetails page

This commit is contained in:
xiaomlove
2022-08-11 13:48:26 +08:00
parent 971f9b8509
commit 72908e38f4
4 changed files with 20 additions and 3 deletions

View File

@@ -17,14 +17,18 @@ class UserMeta extends NexusModel
protected $appends = ['meta_key_text'];
protected $casts = [
'deadline' => 'datetime',
];
public function getMetaKeyTextAttribute()
{
return nexus_trans('label.user_meta.meta_keys.' . $this->meta_key) ?? '';
}
public static function consumeBenefit($uid, $metaKey)
public function isValid(): bool
{
return $this->status == self::STATUS_NORMAL && ($this->getRawOriginal('deadline') === null || ($this->deadline && $this->deadline->gte(now())));
}
}