The framework's source of "now" (BLUEPRINT_V2 §7.11).
Domain time — model timestamps, token and JWT expiry, cache TTLs, rate
limit windows, delayed jobs, schedules, signed URLs — reads Clock.now,
so tests can freeze or travel through time (Laravel travel() /
Carbon::setTestNow()). Wall-clock concerns (timeouts, polling
deadlines, log timestamps) keep using DateTime.now().
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
at<
T> (DateTime time, Future< T> body()) → Future<T> -
Runs
bodywith time frozen attime, restoring afterwards. -
fake(
[DateTime? time]) → DateTime -
Freezes time at
time(default: now). -
freeze(
) → DateTime -
Freezes time at the current instant (
$this->freezeTime()). -
isTimeZone(
String zone) → bool -
Whether
zoneis an IANA name. -
now(
) → DateTime - The current time (frozen when faked).
-
nowIn(
String zone) → DateTime -
Laravel's
now('Asia/Makassar'): the current time in the IANAzone, frozen with now in tests. Itshourand friends read the wall clock there; it compares and serializes as the same instant. -
nowUtc(
) → DateTime - The current time in UTC.
-
restore(
) → void -
Returns to real time (
$this->travelBack()). -
timeZone(
String zone) → Location -
The IANA
zone; an ArgumentError for an unknown name. -
travel(
Duration duration) → DateTime -
Moves (frozen) time forward by
duration; negative values go back. -
travelTo(
DateTime time) → DateTime -
Jumps to
timeand freezes there ($this->travelTo()).