43 lines
928 B
PHP
43 lines
928 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models\Equipment;
|
||
|
|
|
||
|
|
use App\Traits\Auditable;
|
||
|
|
use App\Traits\BelongsToTenant;
|
||
|
|
use App\Traits\ModelTrait;
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
|
||
|
|
class EquipmentInspectionTemplate extends Model
|
||
|
|
{
|
||
|
|
use Auditable, BelongsToTenant, ModelTrait;
|
||
|
|
|
||
|
|
protected $fillable = [
|
||
|
|
'tenant_id',
|
||
|
|
'equipment_id',
|
||
|
|
'inspection_cycle',
|
||
|
|
'item_no',
|
||
|
|
'check_point',
|
||
|
|
'check_item',
|
||
|
|
'check_timing',
|
||
|
|
'check_frequency',
|
||
|
|
'check_method',
|
||
|
|
'sort_order',
|
||
|
|
'is_active',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $casts = [
|
||
|
|
'is_active' => 'boolean',
|
||
|
|
];
|
||
|
|
|
||
|
|
public function equipment(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(Equipment::class, 'equipment_id');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function scopeByCycle($query, string $cycle)
|
||
|
|
{
|
||
|
|
return $query->where('inspection_cycle', $cycle);
|
||
|
|
}
|
||
|
|
}
|