protected function addPolymorphicRules($rules, $polymorphicKey, $type)
    {
        $rules["{$polymorphicKey}Type"] = "required|in:" . $this->getAllowedTypeString($polymorphicKey);
        // Jiu-jitsu here: Want to validate that the morph-to id has a valid entry in the relevant table,
        //   but this will throw an error if the polymorphic type returns an undefined lookup on a config key.
        //   If the lookup test fails, we just skip this rule and run the validator, which will fail on the invalid type
        if (array_key_exists($type, config('combine-core.validation.polymorphicTypes'))) {
            $rules["{$polymorphicKey}Id"] = "required|exists:" . config('combine-core.validation.polymorphicTypes')[$type] . ",id";
        }
        return $rules;
    }
protected function addPolymorphicRules($rules, $polymorphicKey, $type)
    {
        $rules["{$polymorphicKey}Type"] = "required|in:" . $this->getAllowedTypeString($polymorphicKey);
        // Jiu-jitsu here: Want to validate that the morph-to id has a valid entry in the relevant table,
        //   but this will throw an error if the polymorphic type returns an undefined lookup on a config key.
        //   If the lookup test fails, we just skip this rule and run the validator, which will fail on the invalid type
        if (array_key_exists($type, config('combine-core.validation.polymorphicTypes'))) {
            $rules["{$polymorphicKey}Id"] = "required|exists:" . config('combine-core.validation.polymorphicTypes')[$type] . ",id";
        }
        return $rules;
    }
protected function addPolymorphicRules ( $ rules , $ polymorphicKey , $ type ) { $ rules [ "{$polymorphicKey}Type" ] = "required|in:" . $ this -> getAllowedTypeString ( $ polymorphicKey ) ; // Jiu-jitsu here: Want to validate that the morph-to id has a valid entry in the relevant table,
 //   but this will throw an error if the polymorphic type returns an undefined lookup on a config key.
 //   If the lookup test fails, we just skip this rule and run the validator, which will fail on the invalid type
 if ( array_key_exists ( $ type , config ( 'combine-core.validation.polymorphicTypes' ) ) ) { $ rules [ "{$polymorphicKey}Id" ] = "required|exists:" . config ( 'combine-core.validation.polymorphicTypes' ) [ $ type ] . ",id" ; } return $ rules ; }
Updates a validation ruleset to include rules needed for polymorphic Eloquent objects.
@param $type string
@param $rules array Validation rules
@return array
Updates a validation ruleset to include rules needed for polymorphic Eloquent objects .