laravel validation required if another field is not empty code example
Example: laravel form validation based on another field value
$validator = Validator::make($request->all(),[
'program' => 'required',
'music_instrument' => 'required_if:program.*,in:Music'
]);