How to only use created_at in Laravel

后端 未结 17 2065
自闭症患者
自闭症患者 2020-12-07 18:20

I want only use created_at , how to do it?

I know:

This can custom timestamps name

const CREATED_AT = \'created\';
const UPDATED_AT = \'updat         


        
17条回答
  •  感情败类
    2020-12-07 18:53

    I solved by adding default value CURRENT_TIMESTAMP in my database for the column created_at. And In my model I use this below code

    public $timestamps = false;
    protected $dates = ['created_at'];
    

    I hope this method works in all versions of laravel.

提交回复
热议问题