mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
exam user show is_done
This commit is contained in:
@@ -30,6 +30,8 @@ class ExamUserResource extends JsonResource
|
||||
'end' => format_datetime($this->end),
|
||||
'uid' => $this->uid,
|
||||
'exam_id' => $this->exam_id,
|
||||
'is_done' => $this->is_done,
|
||||
'is_done_text' => $this->is_done_text,
|
||||
'user' => new UserResource($this->whenLoaded('user')),
|
||||
'exam' => new ExamResource($this->whenLoaded('exam')),
|
||||
];
|
||||
|
||||
@@ -19,6 +19,11 @@ class ExamUser extends NexusModel
|
||||
const IS_DONE_YES = 1;
|
||||
const IS_DONE_NO = 0;
|
||||
|
||||
public static $isDoneInfo = [
|
||||
self::IS_DONE_YES => ['text' => 'Yes'],
|
||||
self::IS_DONE_NO => ['text' => 'No'],
|
||||
];
|
||||
|
||||
|
||||
protected $casts = [
|
||||
'progress' => 'json'
|
||||
@@ -29,6 +34,11 @@ class ExamUser extends NexusModel
|
||||
return self::$status[$this->status]['text'] ?? '';
|
||||
}
|
||||
|
||||
public function getIsDoneTextAttribute(): string
|
||||
{
|
||||
return self::$isDoneInfo[$this->is_done]['text'] ?? '';
|
||||
}
|
||||
|
||||
public function getBeginAttribute()
|
||||
{
|
||||
$begin = $this->getRawOriginal('begin');
|
||||
|
||||
Reference in New Issue
Block a user