/**
  * Handle the command.
  *
  * @param  FavoriteProductCommand  $command
  * @return void
  */
 public function handle(FavoriteProductCommand $command)
 {
     $user = $this->userRepo->findById($command->userId);
     dd($user);
     $this->productRepo->favorite($command->productIdToFavorite, $user);
     return $user;
 }
 /**
  * Remove the specified Product from storage.
  *
  * @param  int $id
  *
  * @return Response
  */
 public function destroy($id)
 {
     $product = $this->productRepository->find($id);
     if (empty($product)) {
         Flash::error('Product not found');
         return redirect(route('products.index'));
     }
     $this->productRepository->delete($id);
     Flash::success('Product deleted successfully.');
     return redirect(route('products.index'));
 }
 /**
  * Handle the command.
  *
  * @param  UnfavoriteProductCommand  $command
  * @return void
  */
 public function handle(UnfavoriteProductCommand $command)
 {
     $user = $this->userRepo->findById($command->userId);
     $this->productRepo->unFavorite($command->userIdToUnfollow, $user);
     return $user;
 }
 /**
  * Remove the specified Product from storage.
  * DELETE /products/{id}
  *
  * @param  int $id
  *
  * @return Response
  */
 public function destroy($id)
 {
     $this->productRepository->apiDeleteOrFail($id);
     return $this->sendResponse($id, "Product deleted successfully");
 }