예제 #1
0
 /**
  * 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);
 }
예제 #2
0
 /**
  * Execute the command.
  *
  * @param ProductRepository $products
  * @return Product
  */
 public function handle(ProductRepository $products)
 {
     $product = $products->findById($this->id)->fill($this->getProperties());
     $products->save($product);
     $this->saveAttributes($product);
     return $product;
 }
예제 #3
0
 /**
  * Execute the command.
  *
  * @param ProductRepository $products
  * @return Product
  */
 public function handle(ProductRepository $products)
 {
     $product = Product::register($this->product_number, $this->description, $this->product_type_id);
     $products->save($product);
     return $product;
 }