refactor exam progress + filter donate status

This commit is contained in:
xiaomlove
2021-06-11 20:32:57 +08:00
parent 4205978a68
commit 0e8ce200cd
12 changed files with 280 additions and 63 deletions
+16
View File
@@ -59,6 +59,14 @@ class User extends Authenticatable
self::CLASS_STAFF_LEADER => ['text' => 'Staff Leader'],
];
const DONATE_YES = 'yes';
const DONATE_NO = 'no';
public static $donateStatus = [
self::DONATE_YES => ['text' => 'Yes'],
self::DONATE_NO => ['text' => 'No'],
];
public static $cardTitles = [
'uploaded_human' => '上传',
'downloaded_human' => '下载',
@@ -73,6 +81,14 @@ class User extends Authenticatable
return self::$classes[$this->class]['text'] ?? '';
}
public function getDonateStatusAttribute()
{
if (empty($this->donoruntil) || $this->donoruntil == '0000-00-00 00:00:00') {
return self::DONATE_NO;
}
return self::DONATE_YES;
}
/**
* 为数组 / JSON 序列化准备日期。