From 6230f7e836418130f7d95997ac47c44e4fc00435 Mon Sep 17 00:00:00 2001 From: Kekskurse Date: Mon, 8 Feb 2021 11:03:14 +0100 Subject: [PATCH] Stuff --- app/Http/Resources/Gallery.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/Http/Resources/Gallery.php b/app/Http/Resources/Gallery.php index c5419b3..f604406 100644 --- a/app/Http/Resources/Gallery.php +++ b/app/Http/Resources/Gallery.php @@ -32,10 +32,15 @@ class Gallery extends JsonResource ]]; $data["description"] = $this->description; $t = json_decode($this->tags); - foreach ($t as $i => $g) { - $t[$i] = trim($g); + if(is_array($t)) { + foreach ($t as $i => $g) { + $t[$i] = trim($g); + } + $data["tags"] = $t; + } else { + $data["tags"] = null; } - $data["tags"] = $t; + return $data; } }