69 lines
1.6 KiB
PHP
69 lines
1.6 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',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $casts = [
|
||
|
|
'footer_judgement_options' => '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');
|
||
|
|
}
|
||
|
|
}
|