'string', 'student_id' => 'string', 'teacher_id' => 'string', 'total_questions' => 'integer', 'total_score' => 'float', 'status' => 'string', 'difficulty_category' => 'string', 'created_at' => 'datetime', 'updated_at' => 'datetime', 'completed_at' => 'datetime', 'exam_pdf_url' => 'string', 'grading_pdf_url' => 'string', ]; /** * 获取试卷的题目列表 */ public function questions() { return $this->hasMany(PaperQuestion::class, 'paper_id', 'paper_id'); } /** * 获取试卷创建者 */ public function createdByUser() { return $this->belongsTo(User::class, 'created_by', 'user_id'); } /** * 获取关联的学生 */ public function student() { return $this->belongsTo(Student::class, 'student_id', 'student_id'); } /** * 获取关联的教师 */ public function teacher() { return $this->belongsTo(Teacher::class, 'teacher_id', 'teacher_id'); } }