v7.0.0-beta.1 release
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\User;
|
||||
|
||||
use App\Extension\HookManager;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateLanguageRequest 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
|
||||
{
|
||||
$supportedLocales = implode(',', config('app.supported_locales', ['ko', 'en']));
|
||||
|
||||
$rules = [
|
||||
'language' => 'required|string|in:' . $supportedLocales,
|
||||
];
|
||||
|
||||
// 모듈/플러그인이 validation rules를 동적으로 추가할 수 있도록 훅 제공
|
||||
return HookManager::applyFilters('core.user.update_language_validation_rules', $rules, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom messages for validator errors.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'language.required' => __('user.validation.language_required'),
|
||||
'language.string' => __('user.validation.language_string'),
|
||||
'language.in' => __('user.validation.language_invalid'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user