dimanche 28 novembre 2021

Adding validation if another validation passed in laravel FormRequest

Is it possible to add validation if another validation passed for example I have the following validation rules

return [
            'name' => ['required', 'string', 'min:3', 'max:30'],
            'password' => ['required', 'min:6'],
            'photo' => ['imageable'],
            'business_uuid' => ['required', 'uuid', 'exists:businesses,uuid'],
        ];

and I would like if the business_uuid validation passed to add validation for the phone number

'phone' => ['nullable', 'phone:'.$countryCode],

notice that I'm the country code will be brought from the business That's why I'm I'd like to add it if the validation passed



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire