48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class WorkOrderTask extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'work_order_id',
|
|
'task_description',
|
|
'assigned_technician_id',
|
|
'estimated_hours',
|
|
'actual_hours',
|
|
'status',
|
|
'priority',
|
|
'completion_percentage',
|
|
'start_time',
|
|
'completion_time',
|
|
'notes',
|
|
'tools_required',
|
|
'safety_notes',
|
|
];
|
|
|
|
protected $casts = [
|
|
'estimated_hours' => 'decimal:2',
|
|
'actual_hours' => 'decimal:2',
|
|
'completion_percentage' => 'decimal:2',
|
|
'start_time' => 'datetime',
|
|
'completion_time' => 'datetime',
|
|
'tools_required' => 'array',
|
|
];
|
|
|
|
public function workOrder(): BelongsTo
|
|
{
|
|
return $this->belongsTo(WorkOrder::class);
|
|
}
|
|
|
|
public function assignedTechnician(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Technician::class, 'assigned_technician_id');
|
|
}
|
|
}
|