From 960d64eb1292c435086b06b1825617eab584f0a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Wed, 4 Oct 2023 16:25:35 +0200 Subject: [PATCH] Hotfix documents resource --- app/Http/Resources/DocumentResource.php | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/app/Http/Resources/DocumentResource.php b/app/Http/Resources/DocumentResource.php index a4c085a..273c95f 100644 --- a/app/Http/Resources/DocumentResource.php +++ b/app/Http/Resources/DocumentResource.php @@ -16,28 +16,14 @@ class DocumentResource extends JsonResource */ public function toArray($request) { - switch ($this->lang) { - case 1: - $tmpLang = "fr"; - break; - case 2: - $tmpLang = "en"; - break; - case 3: - $tmpLang = "de"; - break; - case 4: - $tmpLang = "nl"; - break; - } return [ 'id' => $this->id, 'uuid' => $this->uuid, 'title' => $this->title, - 'type' => $this->type, + 'type' => $this->type->value, 'directory' => $this->directory_id, 'path' => $this->path, - 'lang' => $tmpLang, + 'lang' => $this->lang->getDefinition(), 'published' => ($this->status) ? 1 : 0, 'parent' => $this->document_id, 'created_at' => $this->created_at,