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.

This PR offers two validation rules - min_digits and max_digits for this usage https://github.com/laravel/framework/pull/43797 Validator::validate([ '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', ], ])
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners