mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-23 19:37:23 +08:00
Introduce filament
This commit is contained in:
+16
-1
@@ -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'] ?? '';
|
||||
|
||||
Reference in New Issue
Block a user