validation rules cannot present if another field has value laravel code example
Example 1: laravel required_if fileld has value
'image' => 'required_if:old_image'
Example 2: laravel form validation based on another field value
$validator = Validator::make($request->all(),[
'program' => 'required',
'music_instrument' => 'required_if:program.*,in:Music'
]);
Example 3: laravel required_if fileld has value
'image' => 'required_without:old_image'