Numeric
class Numeric implements Stringable (View source)
Traits
Properties
protected | $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
$this|TWhenReturnType
when($value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) truthy.
$this|TUnlessReturnType
unless($value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) falsy.
Numeric
between(int|float $min, int|float $max)
The field under validation must have a size between the given min and max (inclusive).
Numeric
decimal(int $min, int|null $max = null)
The field under validation must contain the specified number of decimal places.
Numeric
different(string $field)
The field under validation must have a different value than field.
Numeric
digits(int $length)
The integer under validation must have an exact number of digits.
Numeric
digitsBetween(int $min, int $max)
The integer under validation must between the given min and max number of digits.
Numeric
greaterThan(string $field)
The field under validation must be greater than the given field or value.
Numeric
greaterThanOrEqualTo(string $field)
The field under validation must be greater than or equal to the given field or value.
Numeric
integer()
The field under validation must be an integer.
Numeric
lessThan(string $field)
The field under validation must be less than the given field.
Numeric
lessThanOrEqualTo(string $field)
The field under validation must be less than or equal to the given field.
Numeric
max(int|float $value)
The field under validation must be less than or equal to a maximum value.
Numeric
maxDigits(int $value)
The integer under validation must have a maximum number of digits.
Numeric
min(int|float $value)
The field under validation must have a minimum value.
Numeric
minDigits(int $value)
The integer under validation must have a minimum number of digits.
Numeric
multipleOf(int|float $value)
The field under validation must be a multiple of the given value.
Numeric
same(string $field)
The given field must match the field under validation.
Numeric
exactly(int $value)
The field under validation must match the given value.
string
__toString()
Convert the rule to a validation string.
protected Numeric
addRule(array|string $rules)
Add custom rules to the validation rules array.