trait Illuminate / Database / Eloquent / Concerns / HasTimestamps

HasTimestamps

Properties

public

$timestamps bool

Indicates if the model should be timestamped.

Default: true
protected static

$ignoreTimestampsOn array

The list of models classes that have timestamps temporarily disabled.

Default: []

Methods

public

touch ( $attribute ) : bool

Update the model's update timestamp.

Parameters

  • $attribute string|null
public

touchQuietly ( $attribute ) : bool

Update the model's update timestamp without raising any events.

Parameters

  • $attribute string|null
public

updateTimestamps ( ) : $this

Update the creation and update timestamps.

public

setCreatedAt ( $value ) : $this

Set the value of the "created at" attribute.

Parameters

  • $value mixed
public

setUpdatedAt ( $value ) : $this

Set the value of the "updated at" attribute.

Parameters

  • $value mixed
public

freshTimestamp ( ) : Carbon

Get a fresh timestamp for the model.

public

freshTimestampString ( ) : string

Get a fresh timestamp for the model.

public

usesTimestamps ( ) : bool

Determine if the model uses timestamps.

public

getCreatedAtColumn ( ) : string|null

Get the name of the "created at" column.

public

getUpdatedAtColumn ( ) : string|null

Get the name of the "updated at" column.

public

getQualifiedCreatedAtColumn ( ) : string|null

Get the fully qualified "created at" column.

public

getQualifiedUpdatedAtColumn ( ) : string|null

Get the fully qualified "updated at" column.

public static

withoutTimestamps ( callable $callback ) : mixed

Disable timestamps for the current class during the given callback scope.

Parameters

  • $callback callable
public static

withoutTimestampsOn ( $models , $callback ) : mixed

Disable timestamps for the given model classes during the given callback scope.

Parameters

  • $models array
  • $callback callable
public static

isIgnoringTimestamps ( $class ) : bool

Determine if the given model is ignoring timestamps / touches.

Parameters

  • $class string|null