Laravel 5.4 validation for age lesser than 18:
In laravel 5.4 validation we have only min & max value , which counts the number.
If in such case we have to validate age then this will not help.
For this we have to use regex like this:
'age' => ['required','numeric','regex:/^(?:[1-9]\d{2,}+|[2-9]\d|1[89])$/i'],
It will not allow age lesser than 18
Thanks
No comments:
Post a Comment