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