fix: 🐛 ternaire in listenFormRequest

This commit is contained in:
Nicolas Demangeat 2024-11-27 14:04:12 +01:00
parent 51051adc56
commit e89c6224ff

View file

@ -43,20 +43,12 @@ class ListenFormRequest extends FormRequest
'phone' => [
'present',
'nullable',
!is_null(request()->country) ?
(Country::make(request()->country)->value === Country::france->value ?
'phone:FR|max:25'
: 'number|max:50')
: 'number|max:50'
!is_null(request()->country) ? (Country::make(request()->country)->value === Country::france->value ? 'phone:FR|max:25' : 'number|max:50') : 'number|max:50'
],
'postal_code' => [
'present',
'nullable',
!is_null(request()->country) ?
(Country::make(request()->country)->value === Country::france->value ?
'postal_code:FR|max:25'
: 'number|max:50')
: 'number|max:50'
!is_null(request()->country) ? (Country::make(request()->country)->value === Country::france->value ? 'postal_code:FR|max:25' : 'number|max:50') : 'number|max:50'
],
'city' => 'present|nullable|string|between:3,20',
'country' => ['present', 'nullable', new Enum(Country::class)],