valitron
valitron copied to clipboard
Custom Messages For Rules Set By Alternative Syntax
I don't see a way to set the custom messages for rules set by:
$rules = [ 'required' => 'foo', 'accepted' => 'bar', 'integer' => 'bar' ];
$v = new Valitron\Validator(array('foo' => 'bar', 'bar' => 1)); $v->rules($rules);
Am I missing something?
could add: public function messages($msgs) { static::$_ruleMessages = array_merge(static::$_ruleMessages, $msgs); return $this; }
But that has to be run before the rules have been set
+1