2023-07-21 14:53:44 +02:00
|
|
|
<?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,
|
2023-10-04 16:25:35 +02:00
|
|
|
'type' => $this->type->value,
|
2023-07-21 14:53:44 +02:00
|
|
|
'directory' => $this->directory_id,
|
|
|
|
|
'path' => $this->path,
|
2023-10-04 16:25:35 +02:00
|
|
|
'lang' => $this->lang->getDefinition(),
|
2023-07-21 14:53:44 +02:00
|
|
|
'published' => ($this->status) ? 1 : 0,
|
|
|
|
|
'parent' => $this->document_id,
|
|
|
|
|
'created_at' => $this->created_at,
|
|
|
|
|
'updated_at' => $this->updated_at,
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|