v7.0.0 release
This commit is contained in:
1 parent
0e7fa04b03
commit
c4ea9a6cd1
3582 files changed
+626189
-160151
No files matched your search
@@ -70,6 +70,7 @@ class IdentityPolicy extends Model
|
||||
*/
|
||||
protected array $trackableFields = [
|
||||
'enabled', 'grace_minutes', 'provider_id', 'fail_mode', 'conditions',
|
||||
'purpose', 'applies_to', 'priority',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
|
||||
@@ -8,7 +8,10 @@ use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* 레이아웃 확장 모델
|
||||
@@ -23,11 +26,13 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @property string $source_identifier 출처 식별자
|
||||
* @property string|null $override_target 오버라이드 대상
|
||||
* @property array $content 확장 정의 JSON
|
||||
* @property string|null $original_content_hash 원본 확장 콘텐츠 SHA-256 해시
|
||||
* @property int|null $original_content_size 원본 확장 콘텐츠 바이트 크기
|
||||
* @property int $priority 우선순위
|
||||
* @property bool $is_active 활성 상태
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property \Illuminate\Support\Carbon|null $deleted_at
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Carbon|null $deleted_at
|
||||
* @property-read Template $template 템플릿 관계
|
||||
*/
|
||||
class LayoutExtension extends Model
|
||||
@@ -54,8 +59,11 @@ class LayoutExtension extends Model
|
||||
'source_identifier',
|
||||
'override_target',
|
||||
'content',
|
||||
'original_content_hash',
|
||||
'original_content_size',
|
||||
'priority',
|
||||
'is_active',
|
||||
'lock_version',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -71,24 +79,37 @@ class LayoutExtension extends Model
|
||||
'content' => 'array',
|
||||
'priority' => 'integer',
|
||||
'is_active' => 'boolean',
|
||||
'lock_version' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 템플릿 관계
|
||||
*
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function template(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Template::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 버전 이력 관계
|
||||
*/
|
||||
public function versions(): HasMany
|
||||
{
|
||||
return $this->hasMany(TemplateLayoutExtensionVersion::class, 'extension_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 최신 버전 관계
|
||||
*/
|
||||
public function latestVersion(): HasOne
|
||||
{
|
||||
return $this->hasOne(TemplateLayoutExtensionVersion::class, 'extension_id')
|
||||
->orderByDesc('version');
|
||||
}
|
||||
|
||||
/**
|
||||
* 활성 확장만 조회
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return Builder
|
||||
*/
|
||||
public function scopeActive(Builder $query): Builder
|
||||
{
|
||||
@@ -97,9 +118,6 @@ class LayoutExtension extends Model
|
||||
|
||||
/**
|
||||
* Extension Point 타입만 조회
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return Builder
|
||||
*/
|
||||
public function scopeExtensionPoints(Builder $query): Builder
|
||||
{
|
||||
@@ -108,9 +126,6 @@ class LayoutExtension extends Model
|
||||
|
||||
/**
|
||||
* Overlay 타입만 조회
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return Builder
|
||||
*/
|
||||
public function scopeOverlays(Builder $query): Builder
|
||||
{
|
||||
@@ -119,11 +134,6 @@ class LayoutExtension extends Model
|
||||
|
||||
/**
|
||||
* 특정 출처의 확장만 조회
|
||||
*
|
||||
* @param Builder $query
|
||||
* @param LayoutSourceType $sourceType
|
||||
* @param string $identifier
|
||||
* @return Builder
|
||||
*/
|
||||
public function scopeBySource(Builder $query, LayoutSourceType $sourceType, string $identifier): Builder
|
||||
{
|
||||
@@ -133,9 +143,6 @@ class LayoutExtension extends Model
|
||||
|
||||
/**
|
||||
* 우선순위 순으로 정렬
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return Builder
|
||||
*/
|
||||
public function scopeOrdered(Builder $query): Builder
|
||||
{
|
||||
@@ -145,9 +152,6 @@ class LayoutExtension extends Model
|
||||
|
||||
/**
|
||||
* 템플릿 오버라이드만 조회
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return Builder
|
||||
*/
|
||||
public function scopeTemplateOverrides(Builder $query): Builder
|
||||
{
|
||||
@@ -157,9 +161,7 @@ class LayoutExtension extends Model
|
||||
/**
|
||||
* 특정 모듈/플러그인에 대한 템플릿 오버라이드 조회
|
||||
*
|
||||
* @param Builder $query
|
||||
* @param string $overrideTarget 오버라이드 대상 모듈/플러그인 식별자
|
||||
* @return Builder
|
||||
* @param string $overrideTarget 오버라이드 대상 모듈/플러그인 식별자
|
||||
*/
|
||||
public function scopeOverridingTarget(Builder $query, string $overrideTarget): Builder
|
||||
{
|
||||
@@ -168,9 +170,6 @@ class LayoutExtension extends Model
|
||||
|
||||
/**
|
||||
* 모듈 출처만 조회
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return Builder
|
||||
*/
|
||||
public function scopeFromModules(Builder $query): Builder
|
||||
{
|
||||
@@ -179,9 +178,6 @@ class LayoutExtension extends Model
|
||||
|
||||
/**
|
||||
* 플러그인 출처만 조회
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return Builder
|
||||
*/
|
||||
public function scopeFromPlugins(Builder $query): Builder
|
||||
{
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Concerns\HasUserOverrides;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* 템플릿 커스텀 다국어 키 모델.
|
||||
*
|
||||
* 레이아웃 편집기에서 인라인 편집으로 평문을 `$t:custom.{layout}.{seq}` 키로
|
||||
* 전환할 때 생성되는 동적 다국어 키를 저장합니다. 런타임에는
|
||||
* `MergeCustomTranslations` 리스너가 `template.language.merge` 필터에서
|
||||
* 언어팩보다 높은 우선순위로 병합합니다.
|
||||
*
|
||||
* @property int $id 커스텀 다국어 키 ID
|
||||
* @property int $template_id 소속 템플릿 ID
|
||||
* @property string|null $layout_name 생성 출처 레이아웃 이름
|
||||
* @property string $translation_key 다국어 키 ($t: 참조 경로)
|
||||
* @property array $values 로케일별 번역 값
|
||||
* @property array|null $user_overrides 사용자 수정 보존 추적
|
||||
* @property string $status 상태 (active|orphaned)
|
||||
* @property int|null $created_by 생성자 ID
|
||||
* @property int|null $updated_by 수정자 ID
|
||||
* @property int $lock_version 낙관적 잠금 버전
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property-read Template $template 템플릿 관계
|
||||
*/
|
||||
class TemplateCustomTranslation extends Model
|
||||
{
|
||||
use HasUserOverrides;
|
||||
|
||||
/**
|
||||
* 테이블명
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'template_custom_translations';
|
||||
|
||||
/**
|
||||
* 대량 할당 가능 필드
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'template_id',
|
||||
'layout_name',
|
||||
'translation_key',
|
||||
'values',
|
||||
'status',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
'lock_version',
|
||||
];
|
||||
|
||||
/**
|
||||
* HasUserOverrides — 사용자가 수정 가능한 필드.
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
protected array $trackableFields = ['values'];
|
||||
|
||||
/**
|
||||
* HasUserOverrides — 다국어 JSON 컬럼 sub-key dot-path 단위 보존.
|
||||
* 언어팩 재설치/업그레이드 시 유저가 손댄 로케일 값만 보존됩니다.
|
||||
*
|
||||
* @var array<string>
|
||||
*/
|
||||
protected array $translatableTrackableFields = ['values'];
|
||||
|
||||
/**
|
||||
* 캐스팅
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'values' => 'array',
|
||||
'user_overrides' => 'array',
|
||||
'lock_version' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 템플릿 관계
|
||||
*
|
||||
* @return BelongsTo 템플릿 관계
|
||||
*/
|
||||
public function template(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Template::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 활성 상태 키만 조회
|
||||
*
|
||||
* @param Builder $query 쿼리 빌더
|
||||
* @return Builder 활성 키 쿼리
|
||||
*/
|
||||
public function scopeActive(Builder $query): Builder
|
||||
{
|
||||
return $query->where('status', 'active');
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,7 @@ class TemplateLayout extends Model
|
||||
'updated_by',
|
||||
'original_content_hash',
|
||||
'original_content_size',
|
||||
'lock_version',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -52,6 +53,7 @@ class TemplateLayout extends Model
|
||||
return [
|
||||
'content' => 'array',
|
||||
'source_type' => LayoutSourceType::class,
|
||||
'lock_version' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* 템플릿 레이아웃 첨부 파일 모델
|
||||
*
|
||||
* 레이아웃 편집 중 업로드되는 파일(배경 이미지 등)을 표현한다. 파일 자체는
|
||||
* 코어 StorageInterface 로 저장되고 본 모델은 저장 위치(disk/path)와 메타데이터를
|
||||
* 보관한다. 템플릿 삭제 시 행은 cascadeOnDelete 로 삭제되나, 스토리지 파일
|
||||
* 실삭제는 Service 가 명시적으로 수행한다(CLAUDE.md "DB CASCADE 의존 삭제 금지").
|
||||
*
|
||||
* @property int $id 첨부 파일 ID
|
||||
* @property int $template_id 소속 템플릿 ID
|
||||
* @property string|null $layout_name 사용 출처 레이아웃 이름
|
||||
* @property string $disk 스토리지 디스크 이름
|
||||
* @property string $path 스토리지 내 파일 경로
|
||||
* @property string $original_name 업로드 원본 파일명
|
||||
* @property string $mime_type MIME 타입
|
||||
* @property int $size 파일 크기(바이트)
|
||||
* @property int|null $created_by 업로더 사용자 ID
|
||||
*/
|
||||
class TemplateLayoutAttachment extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* 대량 할당 가능한 속성
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'template_id',
|
||||
'layout_name',
|
||||
'disk',
|
||||
'path',
|
||||
'original_name',
|
||||
'mime_type',
|
||||
'size',
|
||||
'created_by',
|
||||
];
|
||||
|
||||
/**
|
||||
* 속성 캐스팅
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'template_id' => 'integer',
|
||||
'size' => 'integer',
|
||||
'created_by' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 소속 템플릿 관계
|
||||
*
|
||||
* @return BelongsTo<Template, TemplateLayoutAttachment>
|
||||
*/
|
||||
public function template(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Template::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* 템플릿 레이아웃 확장 버전 모델
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $extension_id
|
||||
* @property int $version
|
||||
* @property array $content
|
||||
* @property array|null $changes_summary
|
||||
* @property int|null $created_by
|
||||
* @property Carbon|null $created_at
|
||||
* @property-read LayoutExtension $extension
|
||||
* @property-read User|null $creator
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder latest()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder oldest()
|
||||
*/
|
||||
class TemplateLayoutExtensionVersion extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* 테이블명
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'template_layout_extension_versions';
|
||||
|
||||
/**
|
||||
* 대량 할당 가능한 속성
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'extension_id',
|
||||
'version',
|
||||
'content',
|
||||
'changes_summary',
|
||||
'created_by',
|
||||
];
|
||||
|
||||
/**
|
||||
* updated_at 타임스탬프 비활성화
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public const UPDATED_AT = null;
|
||||
|
||||
/**
|
||||
* 속성 캐스팅
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'content' => 'array',
|
||||
'changes_summary' => 'array',
|
||||
'created_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 레이아웃 확장과의 관계
|
||||
*/
|
||||
public function extension(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(LayoutExtension::class, 'extension_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 생성자와의 관계
|
||||
*/
|
||||
public function creator(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'created_by');
|
||||
}
|
||||
|
||||
/**
|
||||
* 최신 버전순으로 정렬
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return Builder
|
||||
*/
|
||||
public function scopeLatest($query)
|
||||
{
|
||||
return $query->orderBy('version', 'desc')->orderBy('created_at', 'desc');
|
||||
}
|
||||
|
||||
/**
|
||||
* 오래된 버전순으로 정렬
|
||||
*
|
||||
* @param Builder $query
|
||||
* @return Builder
|
||||
*/
|
||||
public function scopeOldest($query)
|
||||
{
|
||||
return $query->orderBy('version', 'asc')->orderBy('created_at', 'asc');
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
@@ -13,10 +14,12 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
* @property string $token
|
||||
* @property int $template_id
|
||||
* @property string $layout_name
|
||||
* @property string $preview_type
|
||||
* @property int|null $extension_id
|
||||
* @property array $content
|
||||
* @property int $admin_id
|
||||
* @property \Carbon\Carbon $expires_at
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property Carbon $expires_at
|
||||
* @property Carbon $created_at
|
||||
*/
|
||||
class TemplateLayoutPreview extends Model
|
||||
{
|
||||
@@ -34,6 +37,8 @@ class TemplateLayoutPreview extends Model
|
||||
'token',
|
||||
'template_id',
|
||||
'layout_name',
|
||||
'preview_type',
|
||||
'extension_id',
|
||||
'content',
|
||||
'admin_id',
|
||||
'expires_at',
|
||||
@@ -54,8 +59,6 @@ class TemplateLayoutPreview extends Model
|
||||
|
||||
/**
|
||||
* 템플릿 관계
|
||||
*
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function template(): BelongsTo
|
||||
{
|
||||
@@ -64,8 +67,6 @@ class TemplateLayoutPreview extends Model
|
||||
|
||||
/**
|
||||
* 생성 관리자 관계
|
||||
*
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function admin(): BelongsTo
|
||||
{
|
||||
@@ -75,8 +76,7 @@ class TemplateLayoutPreview extends Model
|
||||
/**
|
||||
* 만료되지 않은 미리보기만 조회하는 스코프
|
||||
*
|
||||
* @param Builder $query 쿼리 빌더
|
||||
* @return Builder
|
||||
* @param Builder $query 쿼리 빌더
|
||||
*/
|
||||
public function scopeNotExpired(Builder $query): Builder
|
||||
{
|
||||
|
||||
+19
-1
@@ -13,11 +13,12 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphOne;
|
||||
use App\Contracts\UniqueIdServiceInterface;
|
||||
use Illuminate\Contracts\Translation\HasLocalePreference;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
|
||||
class User extends Authenticatable
|
||||
class User extends Authenticatable implements HasLocalePreference
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||||
use HasApiTokens, HasFactory, Notifiable;
|
||||
@@ -153,6 +154,23 @@ class User extends Authenticatable
|
||||
return 'uuid';
|
||||
}
|
||||
|
||||
/**
|
||||
* 알림 발송 시 사용할 수신자 선호 로케일을 반환합니다.
|
||||
*
|
||||
* 사용자 언어 SSoT 는 users.language 컬럼입니다. 지원 로케일이면 해당 값을,
|
||||
* 빈값/미지원 로케일이면 사이트 기본 로케일을 반환합니다. (요청자 locale 폴백 없음)
|
||||
*
|
||||
* @return string|null 지원 로케일이면 해당 값, 아니면 사이트 기본 로케일
|
||||
*/
|
||||
public function preferredLocale(): ?string
|
||||
{
|
||||
$supported = config('app.supported_locales', ['ko', 'en']);
|
||||
|
||||
return ($this->language && in_array($this->language, $supported, true))
|
||||
? $this->language
|
||||
: config('app.locale', 'ko');
|
||||
}
|
||||
|
||||
/**
|
||||
* 모델 부팅 시 UUID 자동 생성을 등록합니다.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user