step 1, 2 and 3 of the implementation plan
This commit is contained in:
48
app/Models/Answer.php
Normal file
48
app/Models/Answer.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user