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
business_uuid
is required so if it doesn't pass then the whole validation will fail. I'm not understanding why you don't want to just add the phone validation anyway.$business->country
so when I try to add thephone
validation in the same rule it doesnt work cause it depends on the$business->country
$countryCode
in the Form Request i.e. please can you show the code for your whole Form Request class?