33 lines
752 B
PHP
33 lines
752 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Database\Factories\QuestionFactory;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Question extends Model
|
|
{
|
|
/** @use HasFactory<QuestionFactory> */
|
|
use HasFactory;
|
|
|
|
protected $fillable = ['quiz_id', 'concept_id', 'body', 'explanation'];
|
|
|
|
public function quiz(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Quiz::class);
|
|
}
|
|
|
|
public function concept(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Concept::class);
|
|
}
|
|
|
|
public function options(): HasMany
|
|
{
|
|
return $this->hasMany(QuestionOption::class);
|
|
}
|
|
}
|