mardi 31 août 2021

Allow only numeric and float value with validation in Laravel

I have a field days in my database nopw i want to save only integer or float value in this column

like values can be

1
2 
0.5 
2.5

i tried to use numeric but then it is not allowing me to enter float values

$this->validate($request, [
     'days' => 'required|numeric|min:1|max:50',
]);

Any help is highly appreciated.

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire