v7.0.0 release

This commit is contained in:
HeuJung committed 2026-07-01 10:30:32 +09:00
1 parent 0e7fa04b03
commit c4ea9a6cd1
3582 files changed
+626189 -160151

No files matched your search

@@ -2,10 +2,11 @@
namespace App\Http\Requests\Admin\Identity;
use App\Contracts\Repositories\IdentityMessageDefinitionRepositoryInterface;
use App\Contracts\Repositories\IdentityPolicyRepositoryInterface;
use App\Extension\HookManager;
use App\Extension\IdentityVerification\IdentityVerificationManager;
use App\Models\IdentityMessageDefinition;
use App\Models\IdentityPolicy;
use App\Rules\LocaleRequiredTranslatable;
use App\Rules\TranslatableField;
use Closure;
@@ -100,9 +101,9 @@ class StoreIdentityMessageDefinitionRequest extends FormRequest
return;
}
$exists = IdentityPolicy::where('key', $value)
->where('source_type', 'admin')
->exists();
// Service-Repository 패턴: Model facade 직접 호출 금지 → Repository Interface 경유.
$exists = app(IdentityPolicyRepositoryInterface::class)
->existsByKeyAndSourceType($value, 'admin');
if (! $exists) {
$fail(__('validation.identity_message.scope_value_not_admin_policy'));
@@ -125,12 +126,11 @@ class StoreIdentityMessageDefinitionRequest extends FormRequest
return;
}
$exists = IdentityMessageDefinition::where('provider_id', $providerId)
->where('scope_type', $scopeType)
->where('scope_value', $value)
->exists();
// Service-Repository 패턴: Model facade 직접 호출 금지 → Repository Interface 경유.
$existing = app(IdentityMessageDefinitionRepositoryInterface::class)
->findByScope($providerId, $scopeType, $value);
if ($exists) {
if ($existing !== null) {
$fail(__('validation.identity_message.definition_already_exists'));
}
};
@@ -0,0 +1,47 @@
<?php
namespace App\Http\Requests\Admin;
use App\Extension\HookManager;
use Illuminate\Foundation\Http\FormRequest;
/**
* 봇 HTML 미리보기 요청 검증.
*
* 편집기가 dirty 레이아웃 + 샘플 컨텍스트를 POST 로 보낸다. 권한 체크는 라우트
* `core.templates.layouts.edit` 미들웨어에서 수행한다(authorize() 는 true 고정).
*/
class SeoBotPreviewRequest extends FormRequest
{
/**
* 사용자가 이 요청을 수행할 권한이 있는지 확인합니다.
*
* 권한 체크는 라우트의 permission 미들웨어에서 수행됩니다.
*
* @return bool 항상 true
*/
public function authorize(): bool
{
return true;
}
/**
* 요청에 적용할 검증 규칙을 반환합니다.
*
* @return array<string, array<int, string>> 검증 규칙 배열
*/
public function rules(): array
{
$rules = [
'layout' => ['required', 'array'],
'route_params' => ['nullable', 'array'],
'url' => ['nullable', 'string'],
'locale' => ['nullable', 'string'],
'module_id' => ['nullable', 'string'],
'plugin_id' => ['nullable', 'string'],
'seed_context' => ['nullable', 'array'],
];
return HookManager::applyFilters('core.seo_bot_preview.show_validation_rules', $rules, $this);
}
}
@@ -0,0 +1,43 @@
<?php
namespace App\Http\Requests\Admin;
use App\Extension\HookManager;
use Illuminate\Foundation\Http\FormRequest;
/**
* SEO 후보 조회 요청 검증.
*
* 편집기가 현재 레이아웃의 extensions·page_type 을 query 로 보낸다. 권한 체크는 라우트
* `core.templates.layouts.edit` 미들웨어에서 수행한다(authorize() 는 true 고정).
*/
class SeoCandidateRequest extends FormRequest
{
/**
* 사용자가 이 요청을 수행할 권한이 있는지 확인합니다.
*
* 권한 체크는 라우트의 permission 미들웨어에서 수행됩니다.
*
* @return bool 항상 true
*/
public function authorize(): bool
{
return true;
}
/**
* 요청에 적용할 검증 규칙을 반환합니다.
*
* @return array<string, array<int, string>> 검증 규칙 배열
*/
public function rules(): array
{
$rules = [
// extensions 는 JSON 문자열 또는 배열 — 컨트롤러가 관대하게 파싱(가드는 미들웨어).
'extensions' => ['nullable'],
'page_type' => ['nullable', 'string'],
];
return HookManager::applyFilters('core.seo_candidate.index_validation_rules', $rules, $this);
}
}
@@ -0,0 +1,46 @@
<?php
namespace App\Http\Requests\Admin;
use App\Extension\HookManager;
use Illuminate\Foundation\Http\FormRequest;
/**
* OG/Twitter/구조화 미리보기 요청 검증.
*
* 편집기가 dirty meta.seo + 샘플 컨텍스트를 POST 로 보낸다. 권한 체크는 라우트
* `core.templates.layouts.edit` 미들웨어에서 수행한다(authorize() 는 true 고정).
*/
class SeoOgPreviewRequest extends FormRequest
{
/**
* 사용자가 이 요청을 수행할 권한이 있는지 확인합니다.
*
* 권한 체크는 라우트의 permission 미들웨어에서 수행됩니다.
*
* @return bool 항상 true
*/
public function authorize(): bool
{
return true;
}
/**
* 요청에 적용할 검증 규칙을 반환합니다.
*
* @return array<string, array<int, string>> 검증 규칙 배열
*/
public function rules(): array
{
$rules = [
'seo' => ['required', 'array'],
// 이 레이아웃이 직접 선언한 meta.seo(base 병합 전). 병합본에는 있으나 own 에 없는
// og/twitter 키 = base 상속(SEO-B). 선택 — 미전달 시 상속/자체 구분 안 함.
'own_seo' => ['nullable', 'array'],
'seed_context' => ['nullable', 'array'],
'route_params' => ['nullable', 'array'],
];
return HookManager::applyFilters('core.seo_og_preview.show_validation_rules', $rules, $this);
}
}
@@ -0,0 +1,40 @@
<?php
namespace App\Http\Requests\Admin\Template;
use App\Extension\HookManager;
use Illuminate\Foundation\Http\FormRequest;
/**
* 템플릿 레이아웃 첨부 파일 목록 조회 요청 검증
*
* 권한은 라우트의 permission 미들웨어(core.templates.layouts.edit)가 담당하므로
* authorize()는 true 를 고정 반환한다.
*/
class ListTemplateLayoutAttachmentsRequest extends FormRequest
{
/**
* 요청 권한 확인 — 권한은 permission 미들웨어가 담당.
*
* @return bool 항상 true
*/
public function authorize(): bool
{
return true;
}
/**
* 검증 규칙 — layout_name 쿼리 필터(선택).
*
* @return array<string, mixed>
*/
public function rules(): array
{
$rules = [
'layout_name' => ['nullable', 'string', 'max:150'],
];
// 모듈/플러그인이 검증 규칙을 동적으로 확장할 수 있도록 훅 제공
return HookManager::applyFilters('core.template_layout_attachment.list_validation_rules', $rules, $this);
}
}
@@ -0,0 +1,63 @@
<?php
namespace App\Http\Requests\Admin\Template;
use App\Extension\HookManager;
use Illuminate\Foundation\Http\FormRequest;
/**
* 템플릿 레이아웃 첨부 파일 업로드 요청 검증
*
* 권한 검사는 라우트의 permission 미들웨어(core.templates.layouts.edit)가 담당하므로
* authorize()는 true 를 고정 반환한다(FormRequest authorize 에 권한 로직 금지 규칙).
*/
class UploadTemplateLayoutAttachmentRequest extends FormRequest
{
/**
* 요청 권한 확인 — 권한은 permission 미들웨어가 담당.
*
* @return bool 항상 true
*/
public function authorize(): bool
{
return true;
}
/**
* 검증 규칙
*
* @return array<string, mixed>
*/
public function rules(): array
{
// 배경 이미지 등 — 이미지 파일만 허용. 최대 크기는 첨부 설정 재사용(MB→KB).
$maxSize = config('attachment.max_file_size', 10240);
$rules = [
'file' => ['required', 'file', 'image', 'mimes:jpg,jpeg,png,gif,webp,svg', 'max:'.$maxSize],
'layout_name' => ['nullable', 'string', 'max:150'],
];
// 모듈/플러그인이 검증 규칙을 동적으로 확장할 수 있도록 훅 제공
return HookManager::applyFilters('core.template_layout_attachment.upload_validation_rules', $rules, $this);
}
/**
* 검증 메시지
*
* @return array<string, string>
*/
public function messages(): array
{
return [
'file.required' => __('templates.layout_attachments.validation.file_required'),
'file.file' => __('templates.layout_attachments.validation.file_invalid'),
'file.image' => __('templates.layout_attachments.validation.file_image'),
'file.mimes' => __('templates.layout_attachments.validation.file_mimes'),
'file.max' => __('templates.layout_attachments.validation.file_max', [
'max' => (int) (config('attachment.max_file_size', 10240) / 1024),
]),
'layout_name.max' => __('templates.layout_attachments.validation.layout_name_max'),
];
}
}