v7.0.0-beta.1 release
This commit is contained in:
commit
6595fd0eb5
3967 files changed
+1875383
No files matched your search
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Public\Module;
|
||||
|
||||
use App\Rules\AllowedModuleFileType;
|
||||
use App\Rules\SafeModulePath;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ServeModuleAssetRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 사용자가 이 요청을 수행할 권한이 있는지 확인
|
||||
*
|
||||
* 권한 체크는 라우트의 permission 미들웨어에서 수행됩니다.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 요청에 적용할 검증 규칙
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
// 모듈 식별자로부터 기준 경로 구성 (모듈 루트)
|
||||
$identifier = $this->route('identifier');
|
||||
$basePath = base_path("modules/{$identifier}");
|
||||
|
||||
return [
|
||||
'identifier' => ['required', 'string'],
|
||||
'path' => [
|
||||
'required',
|
||||
'string',
|
||||
new SafeModulePath($basePath),
|
||||
new AllowedModuleFileType(),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증을 위한 데이터 준비
|
||||
*/
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
// 라우트 파라미터를 검증 데이터에 병합
|
||||
$this->merge([
|
||||
'identifier' => $this->route('identifier'),
|
||||
'path' => $this->route('path'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 오류 메시지 커스터마이징
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'identifier.required' => __('validation.asset.identifier.required'),
|
||||
'identifier.string' => __('validation.asset.identifier.string'),
|
||||
'path.required' => __('validation.asset.path.required'),
|
||||
'path.string' => __('validation.asset.path.string'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Public\Plugin;
|
||||
|
||||
use App\Rules\AllowedPluginFileType;
|
||||
use App\Rules\SafePluginPath;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ServePluginAssetRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 사용자가 이 요청을 수행할 권한이 있는지 확인
|
||||
*
|
||||
* 권한 체크는 라우트의 permission 미들웨어에서 수행됩니다.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 요청에 적용할 검증 규칙
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
// 플러그인 식별자로부터 기준 경로 구성 (플러그인 루트)
|
||||
$identifier = $this->route('identifier');
|
||||
$basePath = base_path("plugins/{$identifier}");
|
||||
|
||||
return [
|
||||
'identifier' => ['required', 'string'],
|
||||
'path' => [
|
||||
'required',
|
||||
'string',
|
||||
new SafePluginPath($basePath),
|
||||
new AllowedPluginFileType(),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증을 위한 데이터 준비
|
||||
*/
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
// 라우트 파라미터를 검증 데이터에 병합
|
||||
$this->merge([
|
||||
'identifier' => $this->route('identifier'),
|
||||
'path' => $this->route('path'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 오류 메시지 커스터마이징
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'identifier.required' => __('validation.asset.identifier.required'),
|
||||
'identifier.string' => __('validation.asset.identifier.string'),
|
||||
'path.required' => __('validation.asset.path.required'),
|
||||
'path.string' => __('validation.asset.path.string'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Public;
|
||||
|
||||
use App\Extension\HookManager;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* 통합 검색 요청 클래스
|
||||
*
|
||||
* 검색어, 페이지네이션 등 기본 검색 파라미터를 검증합니다.
|
||||
* 모듈별 추가 파라미터(type, sort, board_slug 등)는 훅을 통해 확장 가능합니다.
|
||||
*/
|
||||
class SearchRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
// 기본 검색 파라미터
|
||||
'q' => ['nullable', 'string', 'max:200'],
|
||||
'type' => ['nullable', 'string'],
|
||||
'sort' => ['nullable', 'string'],
|
||||
'page' => ['nullable', 'integer', 'min:1'],
|
||||
'per_page' => ['nullable', 'integer', 'min:1', 'max:100'],
|
||||
];
|
||||
|
||||
// 모듈/플러그인이 validation rules를 동적으로 추가할 수 있도록 훅 제공
|
||||
// 예: sort의 in 규칙, board_slug 등 모듈별 파라미터
|
||||
return HookManager::applyFilters('core.search.validation_rules', $rules, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom messages for validator errors.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'q.max' => __('search.validation.q_max'),
|
||||
'page.integer' => __('search.validation.page_integer'),
|
||||
'page.min' => __('search.validation.page_min'),
|
||||
'per_page.integer' => __('search.validation.per_page_integer'),
|
||||
'per_page.min' => __('search.validation.per_page_min'),
|
||||
'per_page.max' => __('search.validation.per_page_max'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Public\Template;
|
||||
|
||||
use App\Rules\AllowedTemplateFileType;
|
||||
use App\Rules\SafeTemplatePath;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ServeTemplateAssetRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 사용자가 이 요청을 수행할 권한이 있는지 확인
|
||||
*
|
||||
* 권한 체크는 라우트의 permission 미들웨어에서 수행됩니다.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 요청에 적용할 검증 규칙
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
// 템플릿 식별자로부터 기준 경로 구성
|
||||
$identifier = $this->route('identifier');
|
||||
$basePath = base_path("templates/{$identifier}/dist");
|
||||
|
||||
return [
|
||||
'identifier' => ['required', 'string'],
|
||||
'path' => [
|
||||
'required',
|
||||
'string',
|
||||
new SafeTemplatePath($basePath),
|
||||
new AllowedTemplateFileType(),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증을 위한 데이터 준비
|
||||
*/
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
// 라우트 파라미터를 검증 데이터에 병합
|
||||
$this->merge([
|
||||
'identifier' => $this->route('identifier'),
|
||||
'path' => $this->route('path'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증 오류 메시지 커스터마이징
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'identifier.required' => __('validation.asset.identifier.required'),
|
||||
'identifier.string' => __('validation.asset.identifier.string'),
|
||||
'path.required' => __('validation.asset.path.required'),
|
||||
'path.string' => __('validation.asset.path.string'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user