Sredny M Casanova
Sredny M Casanova

Reputation: 5063

Float numbers in laravel form

How I limit the quantity of decimals in a input number of laravelCollective?

Upvotes: 4

Views: 11348

Answers (2)

Otho garcia
Otho garcia

Reputation: 141

In the Laravel using the FORM, you need change the parameter 'step'.

{!! Form::number('preco', null, ['class' => 'form-control','step' => '0.1']) !!}

Upvotes: 13

clonelab
clonelab

Reputation: 651

The Laravel between validation rule is actually pretty powerful and can handle decimal values as well. So there's no need to use regex just do this:

'required|between:0,99.99'

Answer taken from here: Laravel validate decimal 0-99.99

Upvotes: 3

Related Questions