Laravel 模型中的 created_at 和 updated_at 使用要使用 时间戳 格式,则需要修改 3 个地方:
-
在
migration中创建表结构使用下面的内容代替$table->timestamps();$table->integer('created_at'); $table->integer('updated_at'); -
重写模型中的
getDateFormat方法,比如<?php protected function getDateFormat() { return 'U'; }
-
确保模型中的
$timestamps = true
目前尚无回复