File: D:/HostingSpaces/SBogers10/ste.komma.pro/app/Pages/Resources/Page.php
<?php declare(strict_types=1);
namespace App\Pages\Resources;
use App\Site\Resources\Site;
use Illuminate\Http\Resources\Json\JsonResource;
use Komma\KMS\Globalization\Languages\Resources\Language;
class Page extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request
* @return array
*/
public function toArray($request)
{
return [
'active' => $this->active,
'lft' => $this->lft,
'rgt' => $this->rgt,
'tree' => $this->tree,
'code_name' => $this->code_name,
'has_wildcard' => $this->has_wildcard,
'site' => $this->whenLoaded('site', new Site($this->site)),
'translations' => PostTranslation::collection($this->whenLoaded('translations')),
'languages' => Language::collection($this->whenLoaded('languages')),
'parent_id' => $this->parent_id
];
}
}