Files
ntspi-app/app/Http/Resources/PostThumbnailResource.php
T
2024-10-04 12:48:19 +05:00

29 lines
712 B
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class PostThumbnailResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'title' => $this->title,
'slug' => $this->slug,
'preview_text' => $this->preview_text,
'category' => $this->category,
'authors' => $this->authors,
'preview' => $this->preview,
'created_post' => $this->created_at->diffforhumans(),
];
}
}