| 12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- class ExamPaperModel extends BaseModel
- {
- protected $table = 'exam_papers';
- public $timestamps = false;
- protected $guarded = [];
- protected $fillable = [
- 'type',
- 'name',
- 'scene_type',
- 'subject_id',
- 'score_total',
- 'topic_count',
- 'is_charge',
- 'status',
- 'sort',
- 'remark',
- 'mark',
- 'create_time'
- ];
- /**
- * 最新答题数据
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function answer()
- {
- return $this->hasOne(ExamAnswerModel::class, 'paper_id', 'id')
- ->where(['status' => 1, 'mark' => 1])
- ->select(['id', 'score', 'accurate_count','user_id', 'answer_times', 'answer_count', 'is_submit'])
- ->orderBy('create_time','desc');
- }
- }
|