Changing timestamp field names

Suppose there are timestamps fields created and modified in table then if we were to use that in project we need to mention it in our model. Like different table names and primaryKey it is usually needed for old projects.

So, following snippet can be used

// In model
public const CREATED_AT = 'created'; // by default it is created_at
public const UPDATED_AT = 'modified'; // by default it is updated_at

Related Posts


Setting up custom date format

Using fillable or guarded