comicId}, chapterId: {$this->chapterId}"); $arrayForUpsert = []; foreach ($this->chapter['sorted'] as $k => $image) { $metadata = $this->chapter; unset($metadata['sorted']); unset($metadata['chapter']['contents'], $metadata['chapter']['words']); $arrayForUpsert[] = [ 'comic_id' => $this->comicId, 'chapter_id' => $this->chapterId, 'order' => $k, 'url' => $image['url'], 'metadata' => json_encode($metadata), ]; } // Do an upsert Image::upsert($arrayForUpsert, uniqueBy: 'url'); Log::info('JOB ImageUpsert END'); } }