Files
go-no-go/app/Models/Answer.php

49 lines
926 B
PHP

<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
final class Answer extends Model
{
/**
* Fillable attributes for mass assignment.
*/
protected $fillable = [
'session_id',
'question_id',
'value',
'text_value',
];
/**
* Cast attributes to specific types.
*/
protected function casts(): array
{
return [
'session_id' => 'integer',
'question_id' => 'integer',
];
}
/**
* Get the session that owns this answer.
*/
public function session(): BelongsTo
{
return $this->belongsTo(Session::class);
}
/**
* Get the question that this answer belongs to.
*/
public function question(): BelongsTo
{
return $this->belongsTo(Question::class);
}
}