품목기준 필드 관리 기능 구현
- ItemField 모델 및 SystemFieldDefinitions 상수 클래스 추가 - ItemFieldSeedingService: 시스템 필드 시딩/초기화/커스텀 필드 CRUD - ItemFieldController (API): HTMX 기반 시딩 상태, 커스텀 필드 관리 - 커스텀 필드 수정 기능 (시스템 필드는 source_table/field_key 수정 불가) - 레거시 데이터 표시 개선: 소스 테이블 비어있으면 '미지정' 배지 - 필드 키 정책 변경: 숫자로 시작 허용 (영문/숫자/밑줄) - AI 문의하기: 시딩 오류 보고서 생성 기능 - 사이드바에 품목기준 필드 관리 메뉴 추가
This commit is contained in:
89
app/Models/ItemField.php
Normal file
89
app/Models/ItemField.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\BelongsToTenant;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* 품목기준 필드 모델
|
||||
*
|
||||
* API DB의 item_fields 테이블을 참조합니다.
|
||||
*/
|
||||
class ItemField extends Model
|
||||
{
|
||||
use BelongsToTenant, SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id',
|
||||
'group_id',
|
||||
'field_name',
|
||||
'field_key',
|
||||
'field_type',
|
||||
'order_no',
|
||||
'is_required',
|
||||
'default_value',
|
||||
'placeholder',
|
||||
'display_condition',
|
||||
'validation_rules',
|
||||
'options',
|
||||
'properties',
|
||||
'category',
|
||||
'description',
|
||||
'is_common',
|
||||
'is_active',
|
||||
'is_locked',
|
||||
'locked_by',
|
||||
'locked_at',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
'deleted_by',
|
||||
// 내부용 매핑 컬럼
|
||||
'source_table',
|
||||
'source_column',
|
||||
'storage_type',
|
||||
'json_path',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'group_id' => 'integer',
|
||||
'order_no' => 'integer',
|
||||
'is_required' => 'boolean',
|
||||
'is_common' => 'boolean',
|
||||
'is_active' => 'boolean',
|
||||
'is_locked' => 'boolean',
|
||||
'display_condition' => 'array',
|
||||
'validation_rules' => 'array',
|
||||
'options' => 'array',
|
||||
'properties' => 'array',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
'deleted_at' => 'datetime',
|
||||
'locked_at' => 'datetime',
|
||||
];
|
||||
|
||||
/**
|
||||
* 시스템 필드 여부 확인 (DB 컬럼과 매핑된 필드)
|
||||
*/
|
||||
public function isSystemField(): bool
|
||||
{
|
||||
return $this->storage_type === 'column' && ! is_null($this->source_column);
|
||||
}
|
||||
|
||||
/**
|
||||
* 컬럼 저장 방식 여부 확인
|
||||
*/
|
||||
public function isColumnStorage(): bool
|
||||
{
|
||||
return $this->storage_type === 'column';
|
||||
}
|
||||
|
||||
/**
|
||||
* JSON 저장 방식 여부 확인
|
||||
*/
|
||||
public function isJsonStorage(): bool
|
||||
{
|
||||
return $this->storage_type === 'json';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user