diff --git a/app/Http/Requests/Fo/ListenFormRequest.php b/app/Http/Requests/Fo/ListenFormRequest.php index fcf993f..4c26f48 100644 --- a/app/Http/Requests/Fo/ListenFormRequest.php +++ b/app/Http/Requests/Fo/ListenFormRequest.php @@ -40,24 +40,22 @@ class ListenFormRequest extends FormRequest 'last_name' => 'required|string|between:3,100', 'society' => 'present|nullable|string|between:3,255', 'email' => 'required|email:rfc,strict,dns,spoof,filter|max:255', - 'phone' => [ - 'present', - 'nullable', - !is_null(request()->input('country')) ? - (Country::make(request()->input('country'))->value === Country::france->value ? - 'phone:FR|max:25' : - 'numeric|max:50') : - 'numeric|max:50' - ], - 'postal_code' => [ - 'present', - 'nullable', - !is_null(request()->input('country')) ? - (Country::make(request()->input('country'))->value === Country::france->value ? - 'postal_code:FR|max:25' : - 'numeric|max:50') : - 'numeric|max:50' - ], + 'phone' => array_merge( + ['present', 'nullable'], + !is_null(request()->input('country')) + ? (Country::make(request()->input('country'))->value === Country::france->value + ? ['phone:FR', 'max:25'] + : ['numeric', 'max:50']) + : ['numeric', 'max:50'] + ), + 'postal_code' => array_merge( + ['present', 'nullable'], + !is_null(request()->input('country')) + ? (Country::make(request()->input('country'))->value === Country::france->value + ? ['postal_code:FR', 'max:25'] + : ['numeric', 'max:50']) + : ['numeric', 'max:50'] + ), 'city' => 'present|nullable|string|between:3,20', 'country' => ['present', 'nullable', new Enum(Country::class)], 'address' => 'present|nullable|string|between:3,255',