belongsToMany(Topic::class, 'exam_paper_topic')->orderBy('sort', 'asc'); } public function getAllotNumsAttribute() { return PaperResult::query()->where('paper_id', $this->attributes['id'])->where('status', ModelStatusEnum::OK)->where('is_answer', 0)->count(); } }