Introduce filament

This commit is contained in:
xiaomlove
2022-06-27 01:39:01 +08:00
parent aae45835ee
commit 1aca20070d
92 changed files with 3535 additions and 83 deletions
+16 -1
View File
@@ -10,7 +10,7 @@ class Medal extends NexusModel
const GET_TYPE_GRANT = 2;
public static $getTypeText = [
public static array $getTypeText = [
self::GET_TYPE_EXCHANGE => ['text' => 'Exchange'],
self::GET_TYPE_GRANT => ['text' => 'Grant'],
];
@@ -19,6 +19,21 @@ class Medal extends NexusModel
public $timestamps = true;
public static function listGetTypes($onlyKeyValues = false): array
{
$results = self::$getTypeText;
$keyValues = [];
foreach ($results as $type => &$info) {
$text = nexus_trans("medal.get_types.$type");
$keyValues[$type] = $text;
$info['text'] = $text;
}
if ($onlyKeyValues) {
return $keyValues;
}
return $results;
}
public function getGetTypeTextAttribute($value): string
{
return self::$getTypeText[$this->get_type]['text'] ?? '';