classes/Input/NestedModels.php
public function getRules($relation, $input)
    {
        $child = $relation->getRelated();

        // If nested is not an Image, don't do anything special.  This will result
        // in the default validation behavior which gets the rules off of the child.
        if (!is_a($child, Image::class)) {
            return;
        }

        // Check for image rules on the parent
        $parent = $relation->getParent();
        $rules_key = 'images.' . ($input['name'] ?: 'default');
        if (!array_key_exists($rules_key, $parent::$rules)) {
            return;
        }

        // Return the parent rules concatenated on the default rules for an Image
        // (those are essentially hardcoded here but I don't expect them to change)
        return [
            'file' => 'image|' . $parent::$rules[$rules_key],
        ];
    }
public function getRules($relation, $input)
    {
        $child = $relation->getRelated();

        // If nested is not an Image, don't do anything special.  This will result
        // in the default validation behavior which gets the rules off of the child.
        if (!is_a($child, Image::class)) {
            return;
        }

        // Check for image rules on the parent
        $parent = $relation->getParent();
        $rules_key = 'images.' . ($input['name'] ?: 'default');
        if (!array_key_exists($rules_key, $parent::$rules)) {
            return;
        }

        // Return the parent rules concatenated on the default rules for an Image
        // (those are essentially hardcoded here but I don't expect them to change)
        return [
            'file' => 'image|' . $parent::$rules[$rules_key],
        ];
    }
public function getRules ( $ relation , $ input ) { $ child = $ relation -> getRelated ( ) ; // If nested is not an Image, don't do anything special.  This will result // in the default validation behavior which gets the rules off of the child. if ( ! is_a ( $ child , Image :: class ) ) { return ; } // Check for image rules on the parent $ parent = $ relation -> getParent ( ) ; $ rules_key = 'images.' . ( $ input [ 'name' ] ? : 'default' ) ; if ( ! array_key_exists ( $ rules_key , $ parent :: $ rules ) ) { return ; } // Return the parent rules concatenated on the default rules for an Image // (those are essentially hardcoded here but I don't expect them to change) return [ 'file' => 'image|' . $ parent :: $ rules [ $ rules_key ] , ] ; }
Get the validation rules.  They are generally on the child except for
in the special case of Images

@param  Relation $relation
@param  array    $input    The data for the nested model
@return array
Get the validation rules . They are generally on the child except for in the special case of Images