['text' => 'Normal'], self::STATUS_FINISHED => ['text' => 'Finished'], ]; const IS_DONE_YES = 1; const IS_DONE_NO = 0; protected $casts = [ 'progress' => 'json' ]; public function getStatusTextAttribute() { return self::$status[$this->status]['text'] ?? ''; } public function getBeginAttribute() { return $this->begin ?? $this->exam->begin; } public function getEndAttribute() { return $this->end ?? $this->exam->end; } public function exam(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(Exam::class, 'exam_id'); } public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo { return $this->belongsTo(User::class, 'uid'); } public function progresses() { return $this->hasMany(ExamProgress::class, 'exam_user_id'); } }