-
Notifications
You must be signed in to change notification settings - Fork 58
Reuse laravel validate rules request & messages #59
Comments
Thanks for your interest, you probably saw that I had my inspiration from Laravel when I created this library, but I stopped using Laravel and there is a few variances with my library and Laravel. I can maybe make some similar but I cannot do them all, you can't do everything the same when dealing with Javascript (AngularJS) and PHP (Laravel), it's just impossible, for example I can't do anything about the The So I think it's doable for some Validators:
Some Validators that I am not sure:
These Validators will be different
And for your question, can we reuse the same Laravel error messages, the answer is...NO Please give some feedback on what I wrote... Thanks |
I not mean to change language package, we can do this
change to
so I can use
it can be custom by coders, if we can do some alias about messages?
in laravel
we can see, laravel message key |
I know you really want it to be the same as Laravel but it can't be, like I said many people already use my library so I don't and won't change the handling of error messages. But seriously, I don't see the need of having exact same error messages!?! If most messages are caught on the client side (Angular-Validation) then what's the point of having exact same messages if user will never, or rarely, see the Laravel error message? What is that going to give you to have exact same messages? So as I said, I could possibly do some changes for some of the Validators (the ones I mentioned in previous message, |
got it, many thank for your notes.you are right about `what's the point of having exact same messages if user will never, or rarely, see the Laravel error message?', I will reconsider my idea. thanks a lot. |
Leave it open, even if I didn't see an advantage to error message being the sames, I do see a big advantage of having similar Validator names, that would be a big benefit of being able to reuse the same names. A developer should always think about having I should have this list of new Validators (some are new, some are just alias)
Most of them are already done, I just need to add So even though I didn't see advantages on error messages, I do see a big advantage on the list of new Validators being similar to Laravel, there is even a few that I was missing and are nice to have. So I hope you didn't get offended from my last reply and will still use my validation library ;) A side note, having 2 layers of validation security (client/server side) is mostly because of hackers/pirates/manInTheMiddle who try to manipulate the form and bypass them completely (disabling JS or whatever else) and in that case those are the bad people that might end up seeing the different error messages, do we care about them seeing something different? Most probably not... that was my conclusion, does it make sense? |
great work! store messages in database or something at server side, provide a unite messages service,can custom by users not coders,it's cool.! go on,these many things to be done :) |
Added few Validators that are like Laravel for reusability. The `in` and `not_in` Validators are the most interesting. The list includes: - accepted: useful on "Terms of service" - between: auto-detect type then use between_len or between_num - max: auto-detect type then use max_len or max_num - min: auto-detect type then use min_len or min_num - size: auto-detect type then use exact_len or exact_num - ip: new alias - digits: similar to exact_len but only for digits - digits_between: similar to between_len but only for digits - in / in_list: useful for accepting a word from a given list of values - not_in / not_in_list: useful for accepting a word outside a given list of values - different: make sure current input is different from another input - same: new alias to match
Pushed into v1.4.4, so go ahead and use it... |
If we can reuse our Laravel Validation Rules, Messages via json response, so we can validate both server side & client side!
laravel's message face to the rules, angular-validation's messages seems to the input name.
when I us between:4,8 , angular-validation cann't validate , as I set min_len:4 , laravel cann't validate, why not use same rules or more rules compatible with laravel, reuse laravel's messages is expect !
good job ! :)
The text was updated successfully, but these errors were encountered: