protected function getFileValidationSnippet(array $fields, $input, $requestVariable = '$this')
    {
        $validation = [];

        $stub = <<<EOF
        if ([% request_variable %]->route()->getAction()['as'] == '[% store_route_name %]' || [% request_variable %]->has('custom_delete_[% field_name %]')) {
            array_push(\$rules['[% field_name %]'], 'required');
        }
EOF;

        foreach ($fields as $field) {
            if ($field->isFile() && $field->isRequired()) {
                $stubCopy = $stub;

                $this->replaceTemplate('field_name', $field->name, $stubCopy)
                    ->replaceRouteNames($stubCopy, $this->getModelName($input->modelName), $input->prefix)
                    ->replaceRequestVariable($stubCopy, $requestVariable);

                $validation[] = $stubCopy;
            }
        }

        return implode(PHP_EOL, $validation);
    }