From 85e03a12dcddf419dfc2a6e7a657e3695aa577fe Mon Sep 17 00:00:00 2001 From: Tyler Date: Sun, 27 Dec 2020 04:45:36 -0500 Subject: [PATCH] Fix image error, group images --- app/Http/Controllers/MainController.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/MainController.php b/app/Http/Controllers/MainController.php index 646c482..39a63f2 100644 --- a/app/Http/Controllers/MainController.php +++ b/app/Http/Controllers/MainController.php @@ -76,15 +76,16 @@ class MainController extends Controller { if (!empty($res)) { if ($images = data_get($res, 'images')) { - $images = array_filter($images, function($item) { - return !empty($item); - }); - foreach ($images as $key => $image) { + if (empty($image)) { + continue; + } + $file = $this->downloadFile($image); $attachment = $book->attach($file, [ - 'key' => $key + 'key' => $key, + 'group' => 'images' ]); $attachment->filename = $key . '.jpg';