HasTimestamps

trait HasTimestamps (View source)

Properties

bool $timestamps Indicates if the model should be timestamped.

Methods

bool touch()

Update the model's update timestamp.

void updateTimestamps()

Update the creation and update timestamps.

$this setCreatedAt(mixed $value)

Set the value of the "created at" attribute.

$this setUpdatedAt(mixed $value)

Set the value of the "updated at" attribute.

Carbon freshTimestamp()

Get a fresh timestamp for the model.

string freshTimestampString()

Get a fresh timestamp for the model.

bool usesTimestamps()

Determine if the model uses timestamps.

string|null getCreatedAtColumn()

Get the name of the "created at" column.

string|null getUpdatedAtColumn()

Get the name of the "updated at" column.

string getQualifiedCreatedAtColumn()

Get the fully qualified "created at" column.

string getQualifiedUpdatedAtColumn()

Get the fully qualified "updated at" column.

Details

bool touch()

Update the model's update timestamp.

Return Value

bool

protected void updateTimestamps()

Update the creation and update timestamps.

Return Value

void

$this setCreatedAt(mixed $value)

Set the value of the "created at" attribute.

Parameters

mixed $value

Return Value

$this

$this setUpdatedAt(mixed $value)

Set the value of the "updated at" attribute.

Parameters

mixed $value

Return Value

$this

Carbon freshTimestamp()

Get a fresh timestamp for the model.

Return Value

Carbon

string freshTimestampString()

Get a fresh timestamp for the model.

Return Value

string

bool usesTimestamps()

Determine if the model uses timestamps.

Return Value

bool

string|null getCreatedAtColumn()

Get the name of the "created at" column.

Return Value

string|null

string|null getUpdatedAtColumn()

Get the name of the "updated at" column.

Return Value

string|null

string getQualifiedCreatedAtColumn()

Get the fully qualified "created at" column.

Return Value

string

string getQualifiedUpdatedAtColumn()

Get the fully qualified "updated at" column.

Return Value

string

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/6.x/Illuminate/Database/Eloquent/Concerns/HasTimestamps.html