/** * Handle the command. * * @param SaveProduct $command * @return void */ public function handle(SaveProduct $command) { $this->productRepository->save($command->input); $modelNumber = $this->productRepository->findLastSavedModelNumber(); $productId = (int) $this->productRepository->findLastSavedId(); $imageCount = $this->imageRepository->count() + 1; $this->imageRepository->uploadImages($command->input['images'], $modelNumber, $productId, $imageCount); }