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 50
bool
touch(array|string|null $attribute = null)
Update the model's update timestamp.
at line 74
bool
touchQuietly(array|string|null $attribute = null)
Update the model's update timestamp without raising any events.
at line 84
HasTimestamps
updateTimestamps()
Update the creation and update timestamps.
at line 108
HasTimestamps
setCreatedAt(mixed $value)
Set the value of the "created at" attribute.
at line 120
HasTimestamps
setUpdatedAt(mixed $value)
Set the value of the "updated at" attribute.
at line 130
CarbonInterface
freshTimestamp()
Get a fresh timestamp for the model.
at line 138
string
freshTimestampString()
Get a fresh timestamp for the model.
at line 146
bool
usesTimestamps()
Determine if the model uses timestamps.
at line 154
string|null
getCreatedAtColumn()
Get the name of the "created at" column.
at line 162
string|null
getUpdatedAtColumn()
Get the name of the "updated at" column.
at line 170
string|null
getQualifiedCreatedAtColumn()
Get the fully qualified "created at" column.
at line 180
string|null
getQualifiedUpdatedAtColumn()
Get the fully qualified "updated at" column.
at line 195
static mixed
withoutTimestamps(callable $callback)
Disable timestamps for the current class during the given callback scope.
at line 209
static mixed
withoutTimestampsOn(array $models, callable $callback)
Disable timestamps for the given model classes during the given callback scope.
at line 227
static bool
isIgnoringTimestamps(string|null $class = null)
Determine if the given model is ignoring timestamps / touches.