[api] reward + thanks

This commit is contained in:
xiaomlove
2022-03-30 15:37:11 +08:00
parent b613a46b8d
commit 3e4a5766c4
38 changed files with 983 additions and 64 deletions

View File

@@ -14,11 +14,13 @@ class NewsResource extends JsonResource
*/
public function toArray($request)
{
$descriptionArr = format_description($this->body);
return [
'id' => $this->id,
'title' => $this->title,
'body' => $this->body,
'added' => $this->added,
'body' => $descriptionArr,
'images' => get_image_from_description($descriptionArr),
'added' => format_datetime($this->added, 'Y.m.d'),
'user' => new UserResource($this->whenLoaded('user'))
];
}