Laravel digits_between Validation Example

Laravel digits_between Validation Example; In this tutorial, you will learn how to set between digits validation in Laravel. In laravel validation, digits_between must have a length min and max. Laravel digits between accept the between number which is added in.

The field under validation must be numeric and must have a length between the given min and max. numeric. This example shows you how to work laravel validation for digits_between. you can see laravel validation digits_between must have a length min and max.

Solution 1:

You should use digits_between when you are trying to get exact same “length”. for example, to validate if user input is a digit between 0 to 99, you just add “digits_between:1,2” in your validation.

    'amount' => 'required|digits_between:1,2'

Solution 2:

If your number is decimal, and want to validate if the entered number is a range number between 1, 1.1, 1.2, 1.3, … to 2, you need to use “numeric|between:1,2” in your validation.

'item' => 'required|numeric|between:1,2',

I hope it works for you.

Leave a Comment