Numeric
class Numeric implements Stringable
Traits
Properties
| protected array | $constraints | The constraints for the number rule. |
Methods
Apply the callback if the given "value" is (or resolves to) truthy.
Apply the callback if the given "value" is (or resolves to) falsy.
The field under validation must have a size between the given min and max (inclusive).
The field under validation must contain the specified number of decimal places.
The integer under validation must between the given min and max number of digits.
The field under validation must be greater than the given field or value.
The field under validation must be greater than or equal to the given field or value.
The field under validation must be less than or equal to the given field.
The field under validation must be less than or equal to a maximum value.
The field under validation must be a multiple of the given value.
Convert the rule to a validation string.
Details
in
Conditionable at line 23
mixed
when(mixed $value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) truthy.
in
Conditionable at line 56
mixed
unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) falsy.
at line 23
Numeric
between(float|int $min, float|int $max)
The field under validation must have a size between the given min and max (inclusive).
at line 31
Numeric
decimal(int $min, int|null $max = null)
The field under validation must contain the specified number of decimal places.
at line 45
Numeric
different(string $field)
The field under validation must have a different value than field.
at line 53
Numeric
digits(int $length)
The integer under validation must have an exact number of digits.
at line 61
Numeric
digitsBetween(int $min, int $max)
The integer under validation must between the given min and max number of digits.
at line 69
Numeric
greaterThan(string $field)
The field under validation must be greater than the given field or value.
at line 77
Numeric
greaterThanOrEqualTo(string $field)
The field under validation must be greater than or equal to the given field or value.
at line 85
Numeric
integer()
The field under validation must be an integer.
at line 93
Numeric
lessThan(string $field)
The field under validation must be less than the given field.
at line 101
Numeric
lessThanOrEqualTo(string $field)
The field under validation must be less than or equal to the given field.
at line 109
Numeric
max(float|int $value)
The field under validation must be less than or equal to a maximum value.
at line 117
Numeric
maxDigits(int $value)
The integer under validation must have a maximum number of digits.
at line 125
Numeric
min(float|int $value)
The field under validation must have a minimum value.
at line 133
Numeric
minDigits(int $value)
The integer under validation must have a minimum number of digits.
at line 141
Numeric
multipleOf(float|int $value)
The field under validation must be a multiple of the given value.
at line 149
Numeric
same(string $field)
The given field must match the field under validation.
at line 157
Numeric
exactly(int $value)
The field under validation must match the given value.
at line 165
string
__toString()
Convert the rule to a validation string.
at line 173
protected Numeric
addRule(array|string $rules)
Add custom rules to the validation rules array.