4

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

Sredny M Casanova
  • 4,735
  • 21
  • 70
  • 115

2 Answers2

13

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

{!! Form::number('preco', null, ['class' => 'form-control','step' => '0.1']) !!}
Floern
  • 33,559
  • 24
  • 104
  • 119
Otho garcia
  • 141
  • 2
  • 8
3

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

Community
  • 1
  • 1
clonerworks
  • 641
  • 1
  • 6
  • 16