Validator extend general rules like 'required': '{{ field }} is required' v4 #1705
Unanswered
the-prodigy
asked this question in
Help
Replies: 1 comment
-
Format the code blocks. Format the code blocks. Format the code blocks. :) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In typically you have like this type of rules in for example UpdateUser Validator:
get messages () { return { 'account_type_id.integer' : 'account_type_id value must be integer', 'username.required' : 'username is required', 'email.email' : 'Invalid email format', 'email.unique' : 'Email is already registered', 'email.min' : 'Email is already registered', } }
And I found a trick to general check like for an required field on every column:
get messages () { return { 'required' : '{{ field }} is required', ... } }
How can I set this type of rule like for all Validators because I dont like to write it again and again the same code to all validators.
I also want when I extend a validator to add custom rules above the extended one, like use the extended validator but nevertheless add custom above it.
I hope you'all understand it.
Beta Was this translation helpful? Give feedback.
All reactions