jeudi 31 décembre 2015

laravel5.1 validate number

How to validate numbers using laravel validator. In my case I need to validate if a number is between "1.00" and "50.00".

As seperator between the number pairs the "." and the "," should be allowed. The number should have only two decimal places. Is there a way to get this done using standart laravel validators combined?

using a regex, the regex should match these requirements:

starting with 0-9 (2 numbers are possible)

followed by one . or one ,

followed with 0-9 (2 numbers are possible)

OR simple numbers like 1-9 with NO dots and NO commas

numbers between 1 and 50 should be allowed in total. This regex should be used for a prepaid system where users should be able to topup their accounts from 1 to 50. For this reason entries like 1.00 and 1,00 should be valid as well as 1 or 2. 50.00 is the maximum of amount. 1.00 the minimum.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire