2026-01-09 13:18:37 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
|
|
|
|
|
|
class EntryResource 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,
|
|
|
|
|
'description' => $this->description,
|
|
|
|
|
'is_published' => $this->is_published,
|
|
|
|
|
'is_featured' => $this->is_featured,
|
|
|
|
|
'published_at' => $this->published_at,
|
|
|
|
|
'content' => $this->content,
|
|
|
|
|
'category' => $this->category->name ?? null,
|
|
|
|
|
'featured_image_url' => $this->getFirstMediaUrl('featured-image') ?: null,
|
2026-01-17 16:35:14 +00:00
|
|
|
'call_to_action_text' => $this->call_to_action_text,
|
|
|
|
|
'call_to_action_link' => $this->call_to_action_link,
|
2026-01-09 13:18:37 +00:00
|
|
|
'created_at' => $this->created_at,
|
|
|
|
|
'updated_at' => $this->updated_at,
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|