laravel8查询出来少8个小时
- config/app.php 设置了
'timezone' => 'PRC', - 数据库字段类型
timestamp
查询出来还是少8个小时,目前找到这个方法解决,每个model都要设置,有什么好的办法统一设置?
#model
use DateTimeInterface;
protected function serializeDate(DateTimeInterface $date){
return $date->format('Y-m-d H:i:s');
}

只要把红框这一行替换成你写的基类文件就好了
关于 LearnKu
推荐文章: