| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- class PaperQuestion extends Model
- {
- protected $table = 'paper_questions';
- protected $primaryKey = 'id';
- public $incrementing = false;
- protected $keyType = 'string';
- public $timestamps = false;
-
- protected $fillable = [
- 'id',
- 'paper_id',
- 'question_bank_id',
- 'knowledge_point',
- 'question_type', // choice-选择题, fill-填空题, answer-解答题
- 'difficulty',
- 'score',
- 'estimated_time',
- 'question_number',
- 'student_answer',
- 'is_correct',
- 'score_obtained',
- ];
-
- protected $casts = [
- 'question_bank_id' => 'integer',
- 'difficulty' => 'float',
- 'score' => 'float',
- 'estimated_time' => 'integer',
- 'question_number' => 'integer',
- 'is_correct' => 'boolean',
- 'score_obtained' => 'float',
- 'question_type' => 'string',
- ];
-
- /**
- * 获取所属试卷
- */
- public function paper()
- {
- return $this->belongsTo(Paper::class, 'paper_id', 'paper_id');
- }
- }
|