Fix image error, group images
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Tyler 2020-12-27 04:45:36 -05:00
parent e9ea25ad38
commit 85e03a12dc
1 changed files with 6 additions and 5 deletions

View File

@ -76,15 +76,16 @@ class MainController extends Controller {
if (!empty($res)) { if (!empty($res)) {
if ($images = data_get($res, 'images')) { if ($images = data_get($res, 'images')) {
$images = array_filter($images, function($item) {
return !empty($item);
});
foreach ($images as $key => $image) { foreach ($images as $key => $image) {
if (empty($image)) {
continue;
}
$file = $this->downloadFile($image); $file = $this->downloadFile($image);
$attachment = $book->attach($file, [ $attachment = $book->attach($file, [
'key' => $key 'key' => $key,
'group' => 'images'
]); ]);
$attachment->filename = $key . '.jpg'; $attachment->filename = $key . '.jpg';