'decimal:2', 'start_km' => 'decimal:2', 'defect_count' => 'integer', 'start_time' => 'datetime', 'stop_time' => 'datetime', 'validated_at' => 'datetime', 'inspected_at' => 'datetime', ]; public function vehicle(): BelongsTo { return $this->belongsTo(Vehicle::class); } public function employee(): BelongsTo { return $this->belongsTo(Employee::class)->withTrashed(); } public function template(): BelongsTo { return $this->belongsTo(P2hTemplate::class, 'template_id'); } public function validator(): BelongsTo { return $this->belongsTo(User::class, 'validated_by'); } public function items(): HasMany { return $this->hasMany(P2hRecordItem::class, 'p2h_record_id'); } public function isPending(): bool { return $this->validation_status === 'pending'; } public function isApproved(): bool { return $this->validation_status === 'approved'; } public function isRejected(): bool { return $this->validation_status === 'rejected'; } public function hasDefects(): bool { return $this->summary_condition === 'has_defect' || $this->defect_count > 0; } }