first commit

This commit is contained in:
Saufi
2026-06-24 20:32:14 +08:00
commit 10fb30ad69
201 changed files with 21356 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class ChecklistItem extends Model
{
use HasFactory;
public const INPUT_TYPES = [
'number' => 'Nombor',
'text' => 'Teks',
'textarea' => 'Teks Panjang',
'select' => 'Senarai Pilihan',
'checkbox' => 'Kotak Semak',
'file_reference' => 'Rujukan Fail',
'calculated' => 'Dikira Automatik',
];
protected $fillable = [
'checklist_section_id',
'checklist_scope_id',
'code',
'formula_token',
'label',
'description',
'input_type',
'options',
'unit',
'is_required',
'is_calculated',
'formula',
'order',
];
protected function casts(): array
{
return [
'options' => 'array',
'is_required' => 'boolean',
'is_calculated' => 'boolean',
'order' => 'integer',
];
}
public function section(): BelongsTo
{
return $this->belongsTo(ChecklistSection::class, 'checklist_section_id');
}
public function scope(): BelongsTo
{
return $this->belongsTo(ChecklistScope::class, 'checklist_scope_id');
}
public function answers(): HasMany
{
return $this->hasMany(SubmissionAnswer::class);
}
public function isNumeric(): bool
{
return in_array($this->input_type, ['number', 'calculated'], true);
}
}