直接在 toArray 方法中对时间字段调用 format 方法即可。
public function toArray($request)
{
return [
'created_at' => $this->created_at->format('Y-m-d H:i:s')
];
}
(adsbygoogle = window.adsbygoogle || []).push({});
来源:https://www.02405.com/archives/12062