ArrayRule
class ArrayRule implements Stringable (View source)
Properties
| protected array | $keys | The accepted keys. |
|
| protected array | $constraints | The additional constraints for the array rule. |
Methods
The field under validation must have between the given min and max number of items (inclusive).
The field under validation must have exactly the given number of items.
The field under validation must not have more than the given number of items.
Convert the rule to a validation string.
Get the array rule with its accepted keys.
Details
__construct(Arrayable|array|null $keys = null)
Create a new array rule instance.
ArrayRule
between(int $min, int $max)
The field under validation must have between the given min and max number of items (inclusive).
ArrayRule
exactly(int $value)
The field under validation must have exactly the given number of items.
ArrayRule
max(int $value)
The field under validation must not have more than the given number of items.
ArrayRule
min(int $value)
The field under validation must have at least the given number of items.
string
__toString()
Convert the rule to a validation string.
protected string
arrayRule()
Get the array rule with its accepted keys.
protected ArrayRule
addRule(array|string $rules)
Add custom rules to the validation rules array.