Files
ntspi-app/app/Http/Resources/PageResource.php
T
2025-03-13 12:17:27 +05:00

32 lines
824 B
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class PageResource 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,
'content' => $this->content,
'slug' => $this->slug,
'code' => $this->code,
'path' => $this->path,
'is_url' => $this->is_url,
'settings' => $this->settings,
'icon' => $this->icon,
'section' => $this->section ? $this->section->title : null,
'created_at' => $this->created_at->diffforhumans()
];
}
}