Date
class Date implements Stringable (View source)
Traits
Properties
static protected array | $macros | The registered string macros. |
from Macroable |
protected | $format | The format of the date. |
|
protected | $constraints | The constraints for the date 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.
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Ensure the date is before today.
Ensure the date is after today.
Ensure the date is before or equal to today.
Ensure the date is after or equal to today.
Ensure the date is on or before the specified date or date field.
Ensure the date is on or after the given date or date field.
Ensure the date is between two dates or date fields.
Ensure the date is between or equal to two dates or date fields.
Format the date for the validation rule.
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.
Date
beforeOrEqual(DateTimeInterface|string $date)
Ensure the date is on or before the specified date or date field.
Date
afterOrEqual(DateTimeInterface|string $date)
Ensure the date is on or after the given date or date field.
Date
between(DateTimeInterface|string $from, DateTimeInterface|string $to)
Ensure the date is between two dates or date fields.
Date
betweenOrEqual(DateTimeInterface|string $from, DateTimeInterface|string $to)
Ensure the date is between or equal to two dates or date fields.