예제 #1
0
 /**
  * @param FileBag|UploadedFile[] $images
  * @param Product                $product
  *
  * @throws \Symfony\Component\HttpFoundation\File\Exception\FileException
  */
 public function attachUploadedImagesToProduct($images, Product $product)
 {
     $product->attachImages(array_map(function (UploadedFile $image) {
         return $this->imageRepository->storeUploadedImage($image)->id;
     }, $images instanceof FileBag ? $images->all() : (array) $images));
 }