I'm using Laravel 5.8.26 and am trying to validate that one field is greater than or equal to another field.
Here's my code:
'amountMin' => 'required|numeric|gte:0',
'amountMax' => 'required|numeric|gte:amountMin',
the value for amountMin
is 5000 and the value for amountMax
is 40000.
when my code runs I get the message that amountMax
must be greater than or equal to amountMin
.
I found this StackOverflow post that says in order to do this you have to create a custom validation rule, but according to the way I understand Laravel validators to work my code should work. Am I wrong, do I need to create a custom validation rule to ensure amountMax
is greater than or equal to amountMin
or do I just need to adjust my code a bit to get it to work?
As always a correct, clearly explained answer will be marked as accepted answer and upvoted.
Thanks in advance.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire