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