laravel中是否有任何验证规则可以采用特定的3种类型的输入?

I have a Sign Up form, that will take User's national Id card number as input. In my country, National ID card number can be 10,13 or 17 digit. How can I validate this type of validation??? My validation code is following:

'user_nid' => 'digits_between:10,17|required|numeric|unique:users'

but, it is not proper way cause it take all the values between 10 to 17. It doesn't full fill the main requirement???

Now what can I do???

You can try to use regex rule:

'user_nid' => 'regex:/(?:\d{17}|\d{13}|\d{10})/',

Alternatively you could create custom validation rule.

The regex is a good way here.

'user_nid' => 'regex:/(?:\d{17}|\d{13}|\d{10})/',

Credit goes to @Alexey

Try custom validator:

Validator::extend('check_user_nid', function($attribute, $value, $parameters, $validator) {
    return strlent((string)$value) == 10 || strlent((string)$value) == 13 || strlent((string)$value) == 17;
});

$validator = Validator::make(["user_nid"=>$request->get('user_nid')], ["user_nid"=>"required|numeric|check_user_nid|unique:users"]);

if ($validator->passes()){
    //true part
}
else {
    //validation does not pass
}

You could do it easily. For example there could be a select box which the user will select what type of id it has (13 number or 17), then you give that value to the max and min value of the input. And in your controller, you just check if it the length of the input data is equal to 13 or 17.