datetime is jsonserializable, didn't know that :)

This commit is contained in:
Dennis Eichhorn 2019-12-29 14:18:46 +01:00
parent 8f89ae7551
commit 0565141f37

View File

@ -433,15 +433,15 @@ class NewsArticle implements ArrayableInterface, \JsonSerializable
public function toArray() : array public function toArray() : array
{ {
return [ return [
'id' => $this->id, 'id' => $this->id,
'title' => $this->title, 'title' => $this->title,
'plain' => $this->plain, 'plain' => $this->plain,
'content' => $this->content, 'content' => $this->content,
'type' => $this->type, 'type' => $this->type,
'status' => $this->status, 'status' => $this->status,
'featured' => $this->featured, 'featured' => $this->featured,
'publish' => $this->publish->format('Y-m-d H:i:s'), 'publish' => $this->publish,
'createdAt' => $this->createdAt->format('Y-m-d H:i:s'), 'createdAt' => $this->createdAt,
'createdBy' => $this->createdBy, 'createdBy' => $this->createdBy,
]; ];
} }