여러 화면에서 조건부(FormRequest) 검증이 우회되거나 과도하게 제한되던 결함을 한 계열로 묶어 수정한다. - 검증 규칙 확장 필터 이름 10개를 나머지 92개와 동일 규칙으로 통일 - 설명 길이를 바이트가 아닌 글자 수로 계산(한글 오검출 해소) - 비활성 언어팩 번역 보존한 채 수정 허용 - 알림 템플릿 제목 nullable 존중, 미지원 발송 수단 저장 차단 - 일정/실행 이력 목록 조회 검증 정합 - 게시판 첨부 미사용 시 빈 확장자 통과, new_display_hours/최소 길이 0 허용, 일괄 적용 override_values 범위 검증(SSoT) - 이커머스 클레임 사유 조회 검증, 용어 정정 - 원문 i18n 키 노출 다수 해소, 저장/삭제 실패 시 사유 화면 노출 - 아이콘 크기/다크모드 대비 회귀 수정 번들 확장(모듈3·플러그인6·템플릿2·언어팩5) 버전 new-bump 및 CHANGELOG 반영, ja 언어팩 동기.
62 lines
2.0 KiB
PHP
62 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\NotificationTemplate;
|
|
|
|
use App\Extension\HookManager;
|
|
use App\Rules\LocaleRequiredTranslatable;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class UpdateNotificationTemplateRequest extends FormRequest
|
|
{
|
|
/**
|
|
* 권한 확인 (미들웨어에서 처리).
|
|
*
|
|
* @return bool 항상 true (권한은 미들웨어에서 검증)
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* 검증 규칙을 반환합니다.
|
|
*
|
|
* @return array 필드별 검증 규칙
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
$rules = [
|
|
// subject 컬럼은 nullable 이다 (제목 개념이 없는 채널이 존재).
|
|
// 스키마와 정합하도록 미전송/null 을 허용한다.
|
|
'subject' => ['sometimes', 'nullable', 'array', new LocaleRequiredTranslatable(maxLength: 500)],
|
|
'body' => ['required', 'array', new LocaleRequiredTranslatable(maxLength: 65535)],
|
|
'click_url' => ['nullable', 'string', 'max:500'],
|
|
'recipients' => ['sometimes', 'nullable', 'array'],
|
|
'recipients.*.type' => ['required', 'string', 'in:trigger_user,related_user,role,specific_users'],
|
|
'recipients.*.value' => ['nullable'],
|
|
'recipients.*.relation' => ['nullable', 'string', 'max:100'],
|
|
'recipients.*.exclude_trigger_user' => ['nullable', 'boolean'],
|
|
'is_active' => ['sometimes', 'boolean'],
|
|
];
|
|
|
|
return HookManager::applyFilters(
|
|
'core.notification_template.update_validation_rules',
|
|
$rules,
|
|
$this->route('template')
|
|
);
|
|
}
|
|
|
|
/**
|
|
* 검증 메시지를 반환합니다.
|
|
*
|
|
* @return array 규칙별 오류 메시지
|
|
*/
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'subject.required' => __('validation.required', ['attribute' => __('notification.subject')]),
|
|
'body.required' => __('validation.required', ['attribute' => __('notification.body')]),
|
|
];
|
|
}
|
|
}
|