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; } }