*/ 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 */ 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'), ]; } }