mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
[admin] add grant props
This commit is contained in:
@@ -42,4 +42,13 @@ class NexusModel extends Model
|
||||
return $d && $d->format($format) === $date;
|
||||
}
|
||||
|
||||
public function getDeadlineText($field = 'deadline')
|
||||
{
|
||||
$raw = $this->getRawOriginal($field);
|
||||
if (in_array($raw, [null, '0000-00-00 00:00:00', ''], true)) {
|
||||
return nexus_trans("label.permanent");
|
||||
}
|
||||
return sprintf('%s: %s', nexus_trans('label.deadline'), $raw);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -503,5 +503,4 @@ class User extends Authenticatable implements FilamentUser, HasName
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+13
-1
@@ -10,7 +10,6 @@ class UserMeta extends NexusModel
|
||||
|
||||
const STATUS_NORMAL = 0;
|
||||
|
||||
|
||||
const META_KEY_PERSONALIZED_USERNAME = 'PERSONALIZED_USERNAME';
|
||||
|
||||
const META_KEY_CHANGE_USERNAME = 'CHANGE_USERNAME';
|
||||
@@ -21,6 +20,19 @@ class UserMeta extends NexusModel
|
||||
'deadline' => 'datetime',
|
||||
];
|
||||
|
||||
public static array $metaKeys = [
|
||||
self::META_KEY_PERSONALIZED_USERNAME => ['text' => 'PERSONALIZED_USERNAME', 'multiple' => false],
|
||||
self::META_KEY_CHANGE_USERNAME => ['text' => 'CHANGE_USERNAME', 'multiple' => false],
|
||||
];
|
||||
|
||||
public static function listProps()
|
||||
{
|
||||
return [
|
||||
self::META_KEY_PERSONALIZED_USERNAME => nexus_trans('label.user_meta.meta_keys.' . self::META_KEY_PERSONALIZED_USERNAME),
|
||||
self::META_KEY_CHANGE_USERNAME => nexus_trans('label.user_meta.meta_keys.' . self::META_KEY_CHANGE_USERNAME),
|
||||
];
|
||||
}
|
||||
|
||||
public function getMetaKeyTextAttribute()
|
||||
{
|
||||
return nexus_trans('label.user_meta.meta_keys.' . $this->meta_key) ?? '';
|
||||
|
||||
Reference in New Issue
Block a user