IT & Programming

Validate a float value in Laravel Framework

There is no validation rule in laravel framework to validate a float or decimal value. Below is the custom validation rule using regex expression.

Script

'price' => 'nullable|regex:/^\d*(\.\d{2})?$/'

Leave A comment

Email address is optional and will not be published. Only add email address if you want a reply from blog author.
Please fill required fields marked with *