Magas
Magas

Reputation: 514

Change column names used to save timestamp

When storing or editing data in a table by laravel it creates a timestamp that uses the fields created_at and updated_at.

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

Without being the solution to set the timestamp = false and at the time of storing myself add the timestamp there.

In the model itself do I have to set the cr‍‍‍‍‍‍‍eated_a‌‌‌‌‌‌t and updated_at data to be saved in other columns?‍‍‍‍‍‌‌‌‌‌

Upvotes: 3

Views: 886

Answers (1)

Andriy Sushchyk
Andriy Sushchyk

Reputation: 178

As Eloquent documentation says, you can override consts on your models

const CREATED_AT = 'created_at_column_name';
const UPDATED_AT = 'updated_at_column_name'; 

Upvotes: 5

Related Questions