- feat: QMS 감사 체크리스트 (AuditChecklist CRUD, 카테고리/항목/표준문서 모델, 마이그레이션) - feat: QMS LOT 감사 (QmsLotAudit 컨트롤러/서비스, 확인/문서상세 FormRequest) - fix: CalendarService, MemberService 수정 - chore: QualityDocumentLocation options 컬럼 추가, tenant_id 마이그레이션, 품질 더미데이터 시더
58 lines
1.2 KiB
PHP
58 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Qualitys;
|
|
|
|
use App\Traits\Auditable;
|
|
use App\Traits\BelongsToTenant;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class AuditChecklist extends Model
|
|
{
|
|
use Auditable, BelongsToTenant, SoftDeletes;
|
|
|
|
protected $table = 'audit_checklists';
|
|
|
|
const STATUS_DRAFT = 'draft';
|
|
|
|
const STATUS_IN_PROGRESS = 'in_progress';
|
|
|
|
const STATUS_COMPLETED = 'completed';
|
|
|
|
const TYPE_STANDARD_MANUAL = 'standard_manual';
|
|
|
|
protected $fillable = [
|
|
'tenant_id',
|
|
'year',
|
|
'quarter',
|
|
'type',
|
|
'status',
|
|
'options',
|
|
'created_by',
|
|
'updated_by',
|
|
'deleted_by',
|
|
];
|
|
|
|
protected $casts = [
|
|
'year' => 'integer',
|
|
'quarter' => 'integer',
|
|
'options' => 'array',
|
|
];
|
|
|
|
public function categories(): HasMany
|
|
{
|
|
return $this->hasMany(AuditChecklistCategory::class, 'checklist_id')->orderBy('sort_order');
|
|
}
|
|
|
|
public function isDraft(): bool
|
|
{
|
|
return $this->status === self::STATUS_DRAFT;
|
|
}
|
|
|
|
public function isCompleted(): bool
|
|
{
|
|
return $this->status === self::STATUS_COMPLETED;
|
|
}
|
|
}
|