Skip to content

Commit 5380d65

Browse files
committed
is_json function
1 parent ce7d94e commit 5380d65

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/UploadableModelTrait.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ private function deleteExisting($key)
145145
{
146146
if (str_contains($this->original[$key], 'storage')) return true;
147147

148-
if (is_json($this->original[$key])) {
148+
if ($this->is_json($this->original[$key])) {
149149
$key = json_decode($this->original[$key]);
150150

151151
foreach ($key as $path) {
@@ -185,4 +185,8 @@ public function setUploadDir(string $upload_dir)
185185
{
186186
$this->upload_dir = $upload_dir;
187187
}
188+
189+
private function is_json($string) {
190+
return is_array(json_decode($string, true));
191+
}
188192
}

0 commit comments

Comments
 (0)