DEV Community 👩‍💻👨‍💻

Morcos Gad
Morcos Gad

Posted on

New Feature Laravel min_digits and max_digits Validation

In the new version 9.26 we have the feature min_digits and max_digits validation

According to the size rule, the number of digits in a digital input cannot be traditionally validated using min and max.

Currently, we have digits to validate the exact length of a number, and digits_between to validate the length within two bounds.

However, as far as I can see, there is still no way to verify that a number has a minimum or maximum number of digits, just both.

This PR offers two validation rules - min_digits and max_digits for this usage

    'number' => 1000,
], [
    'number' => [
        // Passes as `1000` has 4 digits
        'min_digits:3', 'max_digits:5',
        // Fails as `1000` is greater than 5
        'min:3', 'max:5',
Enter fullscreen mode Exit fullscreen mode

I hope you enjoyed with me and to learn more about this release visit the sources and search more. I adore you who search for everything new.

Source :-
Source :-

Top comments (1)

thetnaingtun3 profile image
Thet Naing Tun

Great. Thanks!

Want to Create an Account?
Now it's your turn!
🗒 Share a tutorial
🤔 Reflect on your coding journey
❓ Ask a question

Create an account to join hundreds of thousands of DEV members on their journey.