valitron icon indicating copy to clipboard operation
valitron copied to clipboard

Custom Messages For Rules Set By Alternative Syntax

Open jsamos opened this issue 10 years ago • 2 comments

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

jsamos avatar May 11 '14 05:05 jsamos

+1

suttang avatar Nov 09 '15 09:11 suttang