I have the following Rule :
'Fno' => 'digits:10' 'Lno' => 'min:2|max5' // this seems invalid
But How to have the Rule that
Fno Should be a Digit with Minimum 2 Digit to Maximum 5 Digit and
Lno Should be a Digit only with Min 2 Digit
Advertisement
Answer
If I correctly got what you want:
$rules = ['Fno' => 'digits_between:2,5', 'Lno' => 'numeric|min:2'];
or
$rules = ['Fno' => 'numeric|min:2|max:5', 'Lno' => 'numeric|min:2'];
For all the available rules: http://laravel.com/docs/4.2/validation#available-validation-rules
digits_between :min,max
The field under validation must have a length between the given min and max.
numeric
The field under validation must have a numeric value.
max:value
The field under validation must be less than or equal to a maximum value. Strings, numerics, and files are evaluated in the same fashion as the size rule.
min:value
The field under validation must have a minimum value. Strings, numerics, and files are evaluated in the same fashion as the size rule.