Eloquent model's created_at and updated_at do not work

Posted 7 months ago by Tetravalence

Hello, according to Eloquent documentation if I need to customize the names of the columns used to store the timestamps, I may set the CREATED_AT and UPDATED_AT constants in my model, but this does not seem to work in my application.

<?php

namespace Tetravalence\MyApp;

use Illuminate\Database\Eloquent\Model;

class PostDetail extends Model
{
    const CREATED_AT = 'post_date';

    const UPDATED_AT = 'post_last_update';
...
}

When I run php artisan migrate I still get the default names for the columns. I tried to set the timestamps property on the model to false but it does not work too. Why?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.