49 lines
1003 B
PHP
49 lines
1003 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
final class Question extends Model
|
|
{
|
|
/**
|
|
* Fillable attributes for mass assignment.
|
|
*/
|
|
protected $fillable = [
|
|
'question_group_id',
|
|
'text',
|
|
'has_yes',
|
|
'has_no',
|
|
'has_na',
|
|
'details',
|
|
'sort_order',
|
|
'is_scored',
|
|
];
|
|
|
|
/**
|
|
* Cast attributes to specific types.
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'question_group_id' => 'integer',
|
|
'has_yes' => 'boolean',
|
|
'has_no' => 'boolean',
|
|
'has_na' => 'boolean',
|
|
'sort_order' => 'integer',
|
|
'is_scored' => 'boolean',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the question group that owns this question.
|
|
*/
|
|
public function questionGroup(): BelongsTo
|
|
{
|
|
return $this->belongsTo(QuestionGroup::class);
|
|
}
|
|
}
|