As we all know when we create table using php artisan and migration. Laravel create 2 column in the end of the database that column are created_at and updated_at .
We have a situation when we want to override these two names created_at and updated_at to post_date and post_date_gmt?
Solution :
We can change the name of created_at and updated_at to post_date and post_date_gmt? but that will cause problems with updating timestamps unfortunately.By using the below code we can achieve change name of created_at and updated_at.
const CREATED_AT = 'post_date';
const UPDATED_AT = 'post_modified';
then methods getCreatedAtColumn and getUpdatedAtColumn will return post_date and post_modified respectively, but won't do any harm.
0 Comment(s)