You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.0 KiB
51 lines
1.0 KiB
<?php
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Question extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'se_questions';
|
|
|
|
protected $fillable = [
|
|
'exercise_id',
|
|
'content',
|
|
'description',
|
|
'group_id',
|
|
'question_type_id',
|
|
'level',
|
|
'score',
|
|
'answer',
|
|
'explanation',
|
|
'hint',
|
|
'media_object_id',
|
|
];
|
|
|
|
public function exercise()
|
|
{
|
|
return $this->belongsTo(Exercise::class, 'exercise_id');
|
|
}
|
|
|
|
public function group()
|
|
{
|
|
return $this->belongsTo(QuestionGroup::class, 'group_id');
|
|
}
|
|
|
|
public function type()
|
|
{
|
|
return $this->belongsTo(QuestionType::class, 'question_type_id');
|
|
}
|
|
|
|
public function choices()
|
|
{
|
|
return $this->hasMany(QuestionChoice::class, 'question_id');
|
|
}
|
|
|
|
public function blanks()
|
|
{
|
|
return $this->hasMany(QuestionBlank::class, 'question_id');
|
|
}
|
|
}
|
|
|