88 lines
2.0 KiB
PHP
88 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Modules\Maintenance\Models;
|
|
|
|
use App\Business;
|
|
use App\User;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Overhaul extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'maintenance_overhauls';
|
|
|
|
protected $fillable = [
|
|
'business_id',
|
|
'equipment_id',
|
|
'project_id',
|
|
'production_line_id',
|
|
'title',
|
|
'description',
|
|
'start_date',
|
|
'end_date',
|
|
'estimated_duration_hours',
|
|
'actual_duration_hours',
|
|
'estimated_cost',
|
|
'actual_cost',
|
|
'supervisor_id',
|
|
'assigned_team',
|
|
'contractors',
|
|
'required_parts',
|
|
'required_tools',
|
|
'safety_requirements',
|
|
'shutdown_required',
|
|
'status',
|
|
'attachments',
|
|
];
|
|
|
|
protected $casts = [
|
|
'start_date' => 'date',
|
|
'end_date' => 'date',
|
|
'estimated_duration_hours' => 'decimal:2',
|
|
'actual_duration_hours' => 'decimal:2',
|
|
'estimated_cost' => 'integer',
|
|
'actual_cost' => 'integer',
|
|
'assigned_team' => 'array',
|
|
'contractors' => 'array',
|
|
'required_parts' => 'array',
|
|
'required_tools' => 'array',
|
|
'shutdown_required' => 'boolean',
|
|
'attachments' => 'array',
|
|
];
|
|
|
|
protected static function booted(): void
|
|
{ }
|
|
|
|
public function business()
|
|
{
|
|
return $this->belongsTo(Business::class);
|
|
}
|
|
|
|
public function equipment()
|
|
{
|
|
return $this->belongsTo(Equipment::class, 'equipment_id');
|
|
}
|
|
|
|
public function project()
|
|
{
|
|
return $this->belongsTo(\Modules\Project\Entities\Project::class, 'project_id');
|
|
}
|
|
|
|
public function productionLine()
|
|
{
|
|
return $this->belongsTo(ProductionLine::class, 'production_line_id');
|
|
}
|
|
|
|
public function supervisor()
|
|
{
|
|
return $this->belongsTo(User::class, 'supervisor_id');
|
|
}
|
|
|
|
public function workOrders()
|
|
{
|
|
return $this->hasMany(WorkOrder::class, 'overhaul_id');
|
|
}
|
|
}
|