feat: Initial commit for Saqel Platform architecture, backend, Docker, and documentation
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Answer extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'quiz_attempt_id',
|
||||
'question_id',
|
||||
'selected_option_id',
|
||||
'is_correct',
|
||||
'time_spent_seconds',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'is_correct' => 'boolean',
|
||||
];
|
||||
|
||||
public function attempt(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(QuizAttempt::class, 'quiz_attempt_id');
|
||||
}
|
||||
|
||||
public function question(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Question::class);
|
||||
}
|
||||
|
||||
public function selectedOption(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(QuestionOption::class, 'selected_option_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user