diff --git a/src/Config/README.md b/src/Config/README.md index 798fed3c2..370e4903f 100644 --- a/src/Config/README.md +++ b/src/Config/README.md @@ -9,10 +9,10 @@ Modules and plugins can have config files in the /config directory. Plugin and m ```` // Get a configuration string from the CMS module -echo Config::get('cms::options.allowComments'); +echo Config::get('cms::options.allow_comments'); // Get a configuration string from the october/blog plugin. -echo Config::get('october.blog::options.allowComments'); +echo Config::get('october.blog::options.allow_comments'); ```` ## Overriding configuration strings diff --git a/src/Database/Traits/Validation.php b/src/Database/Traits/Validation.php index bccaca799..80830b839 100644 --- a/src/Database/Traits/Validation.php +++ b/src/Database/Traits/Validation.php @@ -134,7 +134,12 @@ public function addValidationRule(string $name, $definition) $rules = explode('|', $rules); } - $rules[] = $definition; + if (is_array($definition)) { + $rules = array_merge($rules, $definition); + } + else { + $rules[] = $definition; + } $this->rules[$name] = $rules; } @@ -142,8 +147,13 @@ public function addValidationRule(string $name, $definition) /** * removeValidationRule removes a validation rule from the stack and resets the value as a processed array */ - public function removeValidationRule(string $name, $definition) + public function removeValidationRule(string $name, $definition = '*') { + if ($definition === '*') { + unset($this->rules[$name]); + return; + } + $rules = $this->rules[$name] ?? []; if (!is_array($rules)) { $rules = explode('|', $rules);