# Timestamps

Timestamps are a feature of the model used for tracking changes on your entities. With it, you can check when was the model soft deleted, created or last updated.

# Timestamps

# Properties

# createdAt

The createdAt is a static property on the model. The default value is 'createdAt'. You may over ride this if the expected timestamp attribute is named differently. The letter casing is no concern here as getCreatedAtColumn will update it to the correct casing.

# updatedAt

The updatedAt is a static property on the model. The default value is 'updatedAt'. You may over ride this if the expected timestamp attribute is named differently. The letter casing is no concern here as getUpdatedAtColumn will update it to the correct casing.

# timestamps

The timestamps is a read only attribute that signifies whether the model uses timestamps or not. The default value is true;

# Methods

# getCreatedAtColumn

The getCreatedAtColumn method returns the value of the static createdAt value with the letter casing set to the given attributeCasing.

# getUpdatedAtColumn

The getUpdatedAtColumn method returns the value of the static updatedAt value with the letter casing set to the given attributeCasing.

# usesTimestamps

The usesTimestamps method returns the value of the timestamps

# touch

async

The touch method sends a PATCH request with the new updatedAt attribute value. It updates the attribute from the response data.

TIP

Your backend should probably not trust this input, but generate its own timestamp.

# freshTimestamps

async

The freshTimestamps method sends GET request selecting only the createdAt and updatedAt attributes, which are updated from the response on success.

# Soft Deletes

# Properties

# deletedAt

The deletedAt is a static property on the model. The default value is 'deletedAt'. You may over ride this if the expected timestamp attribute is named differently. The letter casing is no concern here as getDeletedAtColumn will update it to the correct casing.

# softDeletes

The softDeletes is a read only attribute that signifies whether the model uses soft deleting or not. The default value is true;

# trashed

The trashed is a getter property that returns a boolean depending on whether the model has the deletedAt set to a truthy value.

# Methods

# getDeletedAtColumn

The getDeletedAtColumn method returns the value of the static deletedAt value with the letter casing set to the given attributeCasing.

# usesSoftDeletes

The usesSoftDeletes method returns the value of the softDeletes

# delete

async

The delete method is an extension of the api calling method delete. If the model is not using softDeletes the logic will fall back to the original delete method's logic therefore, method accepts an optional object argument which will be sent along on the request in the body.

This method sends a DELETE request with the new deletedAt attribute value. It updates the attribute from the response data.

TIP

Your backend should probably not trust this input, but generate its own timestamp.

# restore

async

The restore methods sends a PATCH request with the nullified deletedAt attribute value. It updates the attribute to null on successful request.