ldc-com-app-bo/app/Http/Resources/DocumentResource.php
2023-10-04 16:26:17 +02:00

33 lines
1 KiB
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class DocumentResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
* @phpcs:disable Squiz.Commenting.FunctionComment.TypeHintMissing
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
*/
public function toArray($request)
{
return [
'id' => $this->id,
'uuid' => $this->uuid,
'title' => $this->title,
'type' => $this->type->value,
'directory' => $this->directory_id,
'path' => $this->path,
'lang' => $this->lang->getDefinition(),
'published' => ($this->status) ? 1 : 0,
'parent' => $this->document_id,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
];
}
}