33 lines
850 B
PHP
33 lines
850 B
PHP
<?php
|
|
|
|
namespace App\Modules\Maintenance\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class InspectionVisitItem extends Model
|
|
{
|
|
protected $table = 'maintenance_inspection_visit_items';
|
|
|
|
protected $fillable = [
|
|
'inspection_visit_id', 'equipment_part_id', 'part_label', 'health_percentage',
|
|
'condition', 'notes', 'photos', 'needs_replacement', 'expected_replacement_date',
|
|
];
|
|
|
|
protected $casts = [
|
|
'health_percentage' => 'decimal:2',
|
|
'photos' => 'array',
|
|
'needs_replacement' => 'boolean',
|
|
'expected_replacement_date' => 'date',
|
|
];
|
|
|
|
public function visit()
|
|
{
|
|
return $this->belongsTo(InspectionVisit::class, 'inspection_visit_id');
|
|
}
|
|
|
|
public function equipmentPart()
|
|
{
|
|
return $this->belongsTo(EquipmentPart::class, 'equipment_part_id');
|
|
}
|
|
}
|