HasTimestamps
trait HasTimestamps
Constants
| protected IGNORE_TIMESTAMPS_CONTEXT_KEY |
Context key for storing models that should ignore timestamps. |
Properties
| bool | $timestamps | Indicates if the model should be timestamped. |
Methods
Initialize the HasTimestamps trait.
Update the model's update timestamp.
Update the model's update timestamp without raising any events.
Update the creation and update timestamps.
Set the value of the "created at" attribute.
Set the value of the "updated at" attribute.
Get a fresh timestamp for the model.
Get a fresh timestamp for the model.
Determine if the model uses timestamps.
Get the name of the "created at" column.
Get the name of the "updated at" column.
Get the fully-qualified "created at" column.
Get the fully-qualified "updated at" column.
Disable timestamps for the current class during the given callback scope.
Disable timestamps for the given model classes during the given callback scope.
Determine if the given model is ignoring timestamps / touches.
Details
at line 30
void
initializeHasTimestamps()
Initialize the HasTimestamps trait.
at line 54
bool
touch(array|string|null $attribute = null)
Update the model's update timestamp.
at line 78
bool
touchQuietly(array|string|null $attribute = null)
Update the model's update timestamp without raising any events.
at line 88
HasTimestamps
updateTimestamps()
Update the creation and update timestamps.
at line 112
HasTimestamps
setCreatedAt(mixed $value)
Set the value of the "created at" attribute.
at line 124
HasTimestamps
setUpdatedAt(mixed $value)
Set the value of the "updated at" attribute.
at line 134
CarbonInterface
freshTimestamp()
Get a fresh timestamp for the model.
at line 142
string
freshTimestampString()
Get a fresh timestamp for the model.
at line 150
bool
usesTimestamps()
Determine if the model uses timestamps.
at line 158
string|null
getCreatedAtColumn()
Get the name of the "created at" column.
at line 166
string|null
getUpdatedAtColumn()
Get the name of the "updated at" column.
at line 174
string|null
getQualifiedCreatedAtColumn()
Get the fully-qualified "created at" column.
at line 184
string|null
getQualifiedUpdatedAtColumn()
Get the fully-qualified "updated at" column.
at line 199
static mixed
withoutTimestamps(callable $callback)
Disable timestamps for the current class during the given callback scope.
at line 213
static mixed
withoutTimestampsOn(array $models, callable $callback)
Disable timestamps for the given model classes during the given callback scope.
at line 231
static bool
isIgnoringTimestamps(string|null $class = null)
Determine if the given model is ignoring timestamps / touches.