public $timestamps = true; const CREATED_AT = 'create_time'; const UPDATED_AT = 'update_time';
/* * 自動維護更新時間 */ public function fromDateTime($value) { return strtotime(parent::fromDateTime($value)); }
添加以上代碼后,使用模型添加修改數據會自動維護更新和新增時間並且格式是int
public $timestamps = true; const CREATED_AT = 'create_time'; const UPDATED_AT = 'update_time';
/* * 自動維護更新時間 */ public function fromDateTime($value) { return strtotime(parent::fromDateTime($value)); }
添加以上代碼后,使用模型添加修改數據會自動維護更新和新增時間並且格式是int
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。