protected function formatForSingleResponse(Image $image): array
{
$this->imageRepo->loadThumbs($image);
- $data = $image->getAttributes();
+ $data = $image->toArray();
$data['created_by'] = $image->createdBy;
$data['updated_by'] = $image->updatedBy;
$data['content'] = [];
"name": "Admin",
"slug": "admin"
},
- "updated_at": "2023-03-15 08:17:37",
- "created_at": "2023-03-15 08:17:37",
+ "updated_at": "2023-03-15T16:32:09.000000Z",
+ "created_at": "2023-03-15T16:32:09.000000Z",
"id": 618,
"thumbs": {
"gallery": "https:\/\/p.rizon.top:443\/https\/bookstack.example.com\/uploads\/images\/gallery\/2023-03\/thumbs-150-150\/cute-cat-image.png",
"id": 618,
"name": "cute-cat-image.png",
"url": "https:\/\/p.rizon.top:443\/https\/bookstack.example.com\/uploads\/images\/gallery\/2023-03\/cute-cat-image.png",
- "created_at": "2023-03-15 08:17:37",
- "updated_at": "2023-03-15 08:17:37",
+ "created_at": "2023-03-15T16:32:09.000000Z",
+ "updated_at": "2023-03-15T16:32:09.000000Z",
"created_by": {
"id": 1,
"name": "Admin",
"id": 618,
"name": "My updated image name",
"url": "https:\/\/p.rizon.top:443\/https\/bookstack.example.com\/uploads\/images\/gallery\/2023-03\/cute-cat-image.png",
- "created_at": "2023-03-15 08:17:37",
- "updated_at": "2023-03-15 08:24:50",
+ "created_at": "2023-03-15T16:32:09.000000Z",
+ "updated_at": "2023-03-15T18:31:14.000000Z",
"created_by": {
"id": 1,
"name": "Admin",
'html' => "<a href=\"{$image->url}\" target=\"_blank\"><img src=\"{$displayUrl}\" alt=\"{$image->name}\"></a>",
'markdown' => "",
],
+ 'created_at' => $image->created_at->toISOString(),
+ 'updated_at' => $image->updated_at->toISOString(),
]);
$this->assertStringStartsWith('http://', $resp->json('thumbs.gallery'));
$this->assertStringStartsWith('http://', $resp->json('thumbs.display'));