可以在输出前配置

1
2
3
4
protected $casts = [
'created_at' => 'datetime:Y-m-d h:i:s',
'updated_at' => 'datetime:Y-m-d h:i:s',
];