AbstractRangeRule extends Rule
AbstractYes
Base class for validation rules ensuring a numeric value lies within a specific range.
Extend this class to implement specific range-based validation rules, e.g. latitude, longitude, or bounded numeric limits.
Subclasses must define:
protected float|int $min(the lower bound)protected float|int $max(the upper bound)
Tags
Table of Contents
Properties
- $max : float|int
- Upper numeric bound (inclusive).
- $message : string
- Default message template.
- $min : float|int
- Lower numeric bound (inclusive).
Methods
- check() : bool
- Check if the given value lies within the defined range.
- getMax() : float|int
- Gets the maximum bound.
- getMin() : float|int
- Gets the minimum bound.
Properties
$max
Upper numeric bound (inclusive).
protected
float|int
$max
$message
Default message template.
protected
string
$message
= 'The :attribute must be between :min and :max.'
$min
Lower numeric bound (inclusive).
protected
float|int
$min
Methods
check()
Check if the given value lies within the defined range.
public
check(mixed $value) : bool
Parameters
- $value : mixed
Return values
boolgetMax()
Gets the maximum bound.
public
getMax() : float|int
Return values
float|intgetMin()
Gets the minimum bound.
public
getMin() : float|int