Files
sam-manage/app/Models/Equipment/EquipmentInspectionTemplate.php
김보곤 4115bbd7db feat: [equipment] 설비관리 모듈 구현
- 모델 6개 (Equipment, InspectionTemplate, Inspection, InspectionDetail, Repair, Process)
- 서비스 3개 (Equipment, Inspection, Repair)
- API 컨트롤러 3개 + FormRequest 4개
- Blade 컨트롤러 + 라우트 등록
- 뷰: 대시보드, 등록대장(CRUD), 일상점검표(캘린더 그리드), 수리이력
2026-02-25 19:39:59 +09:00

49 lines
1.0 KiB
PHP

<?php
namespace App\Models\Equipment;
use App\Traits\BelongsToTenant;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class EquipmentInspectionTemplate extends Model
{
use BelongsToTenant;
protected $fillable = [
'tenant_id',
'equipment_id',
'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 scopeActive($query)
{
return $query->where('is_active', true);
}
public function getTimingLabelAttribute(): string
{
return match ($this->check_timing) {
'operating' => '가동 중',
'stopped' => '정지 시',
default => $this->check_timing ?? '-',
};
}
}