first commit
This commit is contained in:
38
app/Models/SubmissionAnswer.php
Normal file
38
app/Models/SubmissionAnswer.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class SubmissionAnswer extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'submission_id',
|
||||
'checklist_item_id',
|
||||
'value',
|
||||
'unit',
|
||||
'page_reference',
|
||||
'consultant_note',
|
||||
'officer_note',
|
||||
'validation_status',
|
||||
];
|
||||
|
||||
public function submission(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Submission::class);
|
||||
}
|
||||
|
||||
public function item(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(ChecklistItem::class, 'checklist_item_id');
|
||||
}
|
||||
|
||||
public function numericValue(): ?float
|
||||
{
|
||||
return is_numeric($this->value) ? (float) $this->value : null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user