- 회사명: 생성 시 테넌트 company_name 자동입력 - 분류: select 변경 (수입검사/중간검사/품질검사 + 커스텀) - 수입검사 → 품목 다중선택 (RM, SM 필터) - 품질검사 → 공정 선택 - 결재라인 단계명: text → select (작성/검토/승인/참조) - 작성 단계: (작성자) 표시, user_id=null - 검토/승인/참조: 테넌트 사용자 검색/선택, user_id 저장 - 공정 검색 API, 테넌트 사용자 검색 API 신규 추가 - ItemApiController에 item_type, ids 파라미터 지원 추가 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
72 lines
1.7 KiB
PHP
72 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Traits\BelongsToTenant;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class DocumentTemplate extends Model
|
|
{
|
|
use HasFactory, BelongsToTenant, SoftDeletes;
|
|
|
|
protected $fillable = [
|
|
'tenant_id',
|
|
'name',
|
|
'category',
|
|
'title',
|
|
'company_name',
|
|
'company_address',
|
|
'company_contact',
|
|
'footer_remark_label',
|
|
'footer_judgement_label',
|
|
'footer_judgement_options',
|
|
'is_active',
|
|
'linked_item_ids',
|
|
'linked_process_id',
|
|
];
|
|
|
|
protected $casts = [
|
|
'footer_judgement_options' => 'array',
|
|
'linked_item_ids' => 'array',
|
|
'is_active' => 'boolean',
|
|
];
|
|
|
|
/**
|
|
* 결재라인
|
|
*/
|
|
public function approvalLines(): HasMany
|
|
{
|
|
return $this->hasMany(DocumentTemplateApprovalLine::class, 'template_id')
|
|
->orderBy('sort_order');
|
|
}
|
|
|
|
/**
|
|
* 기본 필드
|
|
*/
|
|
public function basicFields(): HasMany
|
|
{
|
|
return $this->hasMany(DocumentTemplateBasicField::class, 'template_id')
|
|
->orderBy('sort_order');
|
|
}
|
|
|
|
/**
|
|
* 검사 기준서 섹션
|
|
*/
|
|
public function sections(): HasMany
|
|
{
|
|
return $this->hasMany(DocumentTemplateSection::class, 'template_id')
|
|
->orderBy('sort_order');
|
|
}
|
|
|
|
/**
|
|
* 테이블 컬럼
|
|
*/
|
|
public function columns(): HasMany
|
|
{
|
|
return $this->hasMany(DocumentTemplateColumn::class, 'template_id')
|
|
->orderBy('sort_order');
|
|
}
|
|
} |