diff --git a/README.md b/README.md index 9d40c29..1c83b07 100644 --- a/README.md +++ b/README.md @@ -178,6 +178,7 @@ To add individual label to rule you simply add the `label` method after the rule $v = new Valitron\Validator(array()); $v->rule('required', 'name')->message('{field} is required')->label('Name'); $v->validate(); +``` There is a edge case to this method, you wouldn't be able to use a array of field names in the rule definition, so one rule per field. So this wouldn't work: @@ -185,6 +186,7 @@ There is a edge case to this method, you wouldn't be able to use a array of fiel $v = new Valitron\Validator(array()); $v->rule('required', array('name', 'email'))->message('{field} is required')->label('Name'); $v->validate(); +``` However we can use a array of labels to solve this issue by simply adding the `labels` method instead: @@ -196,6 +198,7 @@ $v->labels(array( 'email' => 'Email address' )); $v->validate(); +``` This introduces a new set of tags to your error language file which looks like `{field}`, if you are using a rule like `equals` you can access the second value in the language file by incrementing the field with a value like `{field1}`.