protected function getStringToNullSnippet(array $fields)
    {
        if ($this->isConvertEmptyStringsToNullRegistered()) {
            return '';
        }

        $code = '';

        foreach ($fields as $field) {
            if ($field->isNullable && !$field->isPrimary && !$field->isAutoIncrement && !$field->isRequired() && !$field->isBoolean() && !$field->isFile()) {
                $code .= sprintf("        \$data['%s'] = !empty(\$request->input('%s')) ? \$request->input('%s') : null;", $field->name, $field->name, $field->name) . PHP_EOL;
            }
        }

        return $code;
    }
protected function getStringToNullSnippet(array $fields)
    {
        if ($this->isConvertEmptyStringsToNullRegistered()) {
            return '';
        }

        $code = '';

        foreach ($fields as $field) {
            if ($field->isNullable && !$field->isPrimary && !$field->isAutoIncrement && !$field->isRequired() && !$field->isBoolean() && !$field->isFile()) {
                $code .= sprintf("        \$data['%s'] = !empty(\$request->input('%s')) ? \$request->input('%s') : null;", $field->name, $field->name, $field->name) . PHP_EOL;
            }
        }

        return $code;
    }
protected function getStringToNullSnippet ( array $ fields ) { if ( $ this -> isConvertEmptyStringsToNullRegistered ( ) ) { return '' ; } $ code = '' ; foreach ( $ fields as $ field ) { if ( $ field -> isNullable && ! $ field -> isPrimary && ! $ field -> isAutoIncrement && ! $ field -> isRequired ( ) && ! $ field -> isBoolean ( ) && ! $ field -> isFile ( ) ) { $ code .= sprintf ( "        \$data['%s'] = !empty(\$request->input('%s')) ? \$request->input('%s') : null;" , $ field -> name , $ field -> name , $ field -> name ) . PHP_EOL ; } } return $ code ; }
Gets the code that is needed to convert empty string to null.

@param array $fields

@return string
Gets the code that is needed to convert empty string to null .