Initial commit
This commit is contained in:
30
app/Models/Answer.php
Normal file
30
app/Models/Answer.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
#[Fillable(['attempt_id', 'question_id', 'option_id', 'text_content'])]
|
||||
class Answer extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public function attempt(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Attempt::class);
|
||||
}
|
||||
|
||||
public function question(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Question::class);
|
||||
}
|
||||
|
||||
public function option(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Option::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user