42 lines
895 B
PHP
42 lines
895 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class ChecklistFormula extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'checklist_template_id',
|
|
'checklist_section_id',
|
|
'result_token',
|
|
'label',
|
|
'expression',
|
|
'unit',
|
|
'guard_div_zero',
|
|
'order',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'guard_div_zero' => 'boolean',
|
|
'order' => 'integer',
|
|
];
|
|
}
|
|
|
|
public function template(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ChecklistTemplate::class, 'checklist_template_id');
|
|
}
|
|
|
|
public function section(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ChecklistSection::class, 'checklist_section_id');
|
|
}
|
|
}
|