protected function replaceRequiredForRequiredWith(ValidationRuleDataInterface $rule, array $requiredWithKeys)
    {
        $rules = array_diff($rule->rules(), ['required']);

        // If there are no required_with keys to replace it with, leave the rule out
        if (count($requiredWithKeys)) {

            $rules[] = 'required_with:' . implode(',', $requiredWithKeys);
        }

        $rule->setRules($rules);
    }
protected function replaceRequiredForRequiredWith(ValidationRuleDataInterface $rule, array $requiredWithKeys)
    {
        $rules = array_diff($rule->rules(), ['required']);

        // If there are no required_with keys to replace it with, leave the rule out
        if (count($requiredWithKeys)) {

            $rules[] = 'required_with:' . implode(',', $requiredWithKeys);
        }

        $rule->setRules($rules);
    }
protected function replaceRequiredForRequiredWith ( ValidationRuleDataInterface $ rule , array $ requiredWithKeys ) { $ rules = array_diff ( $ rule -> rules ( ) , [ 'required' ] ) ; // If there are no required_with keys to replace it with, leave the rule out if ( count ( $ requiredWithKeys ) ) { $ rules [ ] = 'required_with:' . implode ( ',' , $ requiredWithKeys ) ; } $ rule -> setRules ( $ rules ) ; }
Updates the rules in a validation data object to replace the required rule with
a required_with rule for multiple fields.

@param ValidationRuleDataInterface $rule
@param array                       $requiredWithKeys
Updates the rules in a validation data object to replace the required rule with a required_with rule for multiple fields .