Change column names used to save timestamp

Asked

Viewed 312 times

2

When I store or edit data in a table by Larable this creates a timestamp using the fields created_at and updated_at

But I have to store the data in a table shared with another system, and this uses another nomenclature to store this data.

Without being the solution to set the timestamp = false and when it comes time to store the timestamp there.

In itself model has how I set the name of creted_at and updated_at to another?

1 answer

2


I found this example in documentation of the Laravel and it worked

If you need to customize the Names of the Columns used to store the timestamps, you may set the CREATED_AT and UPDATED_AT constants in your model:

class Flight extends Model
{
    const CREATED_AT = 'creation_date';
    const UPDATED_AT = 'last_update';
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.