removed productimage and productvideo helper

This commit is contained in:
prateek srivastava 2021-01-06 15:47:30 +05:30
parent 63b8da2c46
commit 24afa07e66
9 changed files with 4 additions and 82 deletions

View File

@ -14,8 +14,6 @@ class Product extends JsonResource
*/ */
public function __construct($resource) public function __construct($resource)
{ {
$this->productImageHelper = app('Webkul\Product\Helpers\ProductImage');
$this->productReviewHelper = app('Webkul\Product\Helpers\Review'); $this->productReviewHelper = app('Webkul\Product\Helpers\Review');
parent::__construct($resource); parent::__construct($resource);
@ -44,7 +42,7 @@ class Product extends JsonResource
'description' => $this->description, 'description' => $this->description,
'sku' => $this->sku, 'sku' => $this->sku,
'images' => ProductImage::collection($product->images), 'images' => ProductImage::collection($product->images),
'base_image' => $this->productImageHelper->getProductBaseImage($product), 'base_image' => app('Webkul\Product\ProductImage')->getProductBaseImage($product),
'variants' => Self::collection($this->variants), 'variants' => Self::collection($this->variants),
'in_stock' => $product->haveSufficientQuantity(1), 'in_stock' => $product->haveSufficientQuantity(1),
$this->mergeWhen($product->getTypeInstance()->isComposite(), [ $this->mergeWhen($product->getTypeInstance()->isComposite(), [

View File

@ -9,7 +9,6 @@ use Webkul\BookingProduct\Helpers\Booking as BookingHelper;
use Webkul\BookingProduct\Repositories\BookingProductRepository; use Webkul\BookingProduct\Repositories\BookingProductRepository;
use Webkul\Checkout\Models\CartItem; use Webkul\Checkout\Models\CartItem;
use Webkul\Product\Datatypes\CartItemValidationResult; use Webkul\Product\Datatypes\CartItemValidationResult;
use Webkul\Product\Helpers\ProductImage;
use Webkul\Product\Repositories\ProductAttributeValueRepository; use Webkul\Product\Repositories\ProductAttributeValueRepository;
use Webkul\Product\Repositories\ProductImageRepository; use Webkul\Product\Repositories\ProductImageRepository;
use Webkul\Product\Repositories\ProductVideoRepository; use Webkul\Product\Repositories\ProductVideoRepository;
@ -56,7 +55,6 @@ class Booking extends Virtual
* @param \Webkul\Product\Repositories\ProductAttributeValueRepository $attributeValueRepository * @param \Webkul\Product\Repositories\ProductAttributeValueRepository $attributeValueRepository
* @param \Webkul\Product\Repositories\ProductInventoryRepository $productInventoryRepository * @param \Webkul\Product\Repositories\ProductInventoryRepository $productInventoryRepository
* @param \Webkul\Product\Repositories\ProductImageRepository $productImageRepository * @param \Webkul\Product\Repositories\ProductImageRepository $productImageRepository
* @param \Webkul\Product\Helpers\ProductImage $productImageHelper
* @param \Webkul\BookingProduct\Repositories\BookingProductRepository $bookingProductRepository * @param \Webkul\BookingProduct\Repositories\BookingProductRepository $bookingProductRepository
* @param \Webkul\BookingProduct\Helpers\BookingHelper $bookingHelper * @param \Webkul\BookingProduct\Helpers\BookingHelper $bookingHelper
* @param \Webkul\Product\Repositories\ProductVideoRepository $productVideoRepository * @param \Webkul\Product\Repositories\ProductVideoRepository $productVideoRepository
@ -68,7 +66,6 @@ class Booking extends Virtual
ProductAttributeValueRepository $attributeValueRepository, ProductAttributeValueRepository $attributeValueRepository,
ProductInventoryRepository $productInventoryRepository, ProductInventoryRepository $productInventoryRepository,
ProductImageRepository $productImageRepository, ProductImageRepository $productImageRepository,
ProductImage $productImageHelper,
BookingProductRepository $bookingProductRepository, BookingProductRepository $bookingProductRepository,
BookingHelper $bookingHelper, BookingHelper $bookingHelper,
ProductVideoRepository $productVideoRepository ProductVideoRepository $productVideoRepository
@ -80,7 +77,6 @@ class Booking extends Virtual
$attributeValueRepository, $attributeValueRepository,
$productInventoryRepository, $productInventoryRepository,
$productImageRepository, $productImageRepository,
$productImageHelper,
$productVideoRepository $productVideoRepository
); );

View File

@ -5,7 +5,7 @@ namespace Webkul\Product\Helpers;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
class ProductVideo extends AbstractProduct class ProductVideo extends AbstractProduct
{ {
/** /**
* Retrieve collection of videos * Retrieve collection of videos
* *

View File

@ -111,40 +111,4 @@ class ProductServiceProvider extends ServiceProvider
return app()->make(ProductVideo::class); return app()->make(ProductVideo::class);
}); });
} }
/**
* Register facade
*
*/
public function registerFacadesd()
{
//to make the cart facade and bind the
//alias to the class needed to be called.
// $loader = AliasLoader::getInstance();
// $loader->alias('productimage', ProductImageFacade::class);
// $this->app->singleton('productimage', function () {
// return new cart();
// });
// $this->app->bind('productimage', 'Webkul\Checkout\Cart');
// \App::bind('mysiteclass', function()
// {
// return new \Webkul\Product\Helpers\ProductImage;
// });
$this->app->bind('ProductImage', function() {
return new ProductImage;
});
// $loader = AliasLoader::getInstance();
// $loader->alias('productimage', ProductImageFacade::class);
// $this->app->singleton('productimage', function () {
// return app()->make(ProductImage::class);
// });
}
} }

View File

@ -5,7 +5,6 @@ namespace Webkul\Product\Type;
use Webkul\Checkout\Facades\Cart; use Webkul\Checkout\Facades\Cart;
use Webkul\Checkout\Models\CartItem; use Webkul\Checkout\Models\CartItem;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Webkul\Product\Helpers\ProductImage;
use Webkul\Product\Models\ProductAttributeValue; use Webkul\Product\Models\ProductAttributeValue;
use Webkul\Product\Repositories\ProductRepository; use Webkul\Product\Repositories\ProductRepository;
use Webkul\Attribute\Repositories\AttributeRepository; use Webkul\Attribute\Repositories\AttributeRepository;
@ -59,13 +58,6 @@ abstract class AbstractType
*/ */
protected $productVideoRepository; protected $productVideoRepository;
/**
* Product Image helper instance
*
* @var \Webkul\Product\Helpers\ProductImage
*/
protected $productImageHelper;
/** /**
* Product model instance * Product model instance
* *
@ -148,7 +140,6 @@ abstract class AbstractType
* @param \Webkul\Product\Repositories\ProductAttributeValueRepository $attributeValueRepository * @param \Webkul\Product\Repositories\ProductAttributeValueRepository $attributeValueRepository
* @param \Webkul\Product\Repositories\ProductInventoryRepository $productInventoryRepository * @param \Webkul\Product\Repositories\ProductInventoryRepository $productInventoryRepository
* @param \Webkul\Product\Repositories\ProductImageRepository $productImageRepository * @param \Webkul\Product\Repositories\ProductImageRepository $productImageRepository
* @param \Webkul\Product\Helpers\ProductImage $productImageHelper
* @param \Webkul\Product\Repositories\ProductVideoRepository $productVideoRepository * @param \Webkul\Product\Repositories\ProductVideoRepository $productVideoRepository
* *
* @return void * @return void
@ -159,7 +150,6 @@ abstract class AbstractType
ProductAttributeValueRepository $attributeValueRepository, ProductAttributeValueRepository $attributeValueRepository,
ProductInventoryRepository $productInventoryRepository, ProductInventoryRepository $productInventoryRepository,
ProductImageRepository $productImageRepository, ProductImageRepository $productImageRepository,
ProductImage $productImageHelper,
ProductVideoRepository $productVideoRepository ProductVideoRepository $productVideoRepository
) { ) {
$this->attributeRepository = $attributeRepository; $this->attributeRepository = $attributeRepository;
@ -172,8 +162,6 @@ abstract class AbstractType
$this->productImageRepository = $productImageRepository; $this->productImageRepository = $productImageRepository;
$this->productImageHelper = $productImageHelper;
$this->productVideoRepository = $productVideoRepository; $this->productVideoRepository = $productVideoRepository;
} }

View File

@ -11,7 +11,6 @@ use Webkul\Product\Repositories\ProductImageRepository;
use Webkul\Product\Repositories\ProductVideoRepository; use Webkul\Product\Repositories\ProductVideoRepository;
use Webkul\Product\Repositories\ProductBundleOptionRepository; use Webkul\Product\Repositories\ProductBundleOptionRepository;
use Webkul\Product\Repositories\ProductBundleOptionProductRepository; use Webkul\Product\Repositories\ProductBundleOptionProductRepository;
use Webkul\Product\Helpers\ProductImage;
use Webkul\Product\Helpers\BundleOption; use Webkul\Product\Helpers\BundleOption;
use Webkul\Checkout\Models\CartItem; use Webkul\Checkout\Models\CartItem;
@ -88,7 +87,6 @@ class Bundle extends AbstractType
* @param \Webkul\Product\Repositories\ProductImageRepository $productImageRepository * @param \Webkul\Product\Repositories\ProductImageRepository $productImageRepository
* @param \Webkul\Product\Repositories\ProductBundleOptionRepository $productBundleOptionRepository * @param \Webkul\Product\Repositories\ProductBundleOptionRepository $productBundleOptionRepository
* @param \Webkul\Product\Repositories\ProductBundleOptionProductRepository $productBundleOptionProductRepository * @param \Webkul\Product\Repositories\ProductBundleOptionProductRepository $productBundleOptionProductRepository
* @param \Webkul\Product\Helpers\ProductImage $productImageHelper
* @param \Webkul\Product\Helpers\BundleOption $bundleOptionHelper * @param \Webkul\Product\Helpers\BundleOption $bundleOptionHelper
* @param \Webkul\Product\Repositories\ProductVideoRepository $productVideoRepository * @param \Webkul\Product\Repositories\ProductVideoRepository $productVideoRepository
* @return void * @return void
@ -101,7 +99,6 @@ class Bundle extends AbstractType
ProductImageRepository $productImageRepository, ProductImageRepository $productImageRepository,
ProductBundleOptionRepository $productBundleOptionRepository, ProductBundleOptionRepository $productBundleOptionRepository,
ProductBundleOptionProductRepository $productBundleOptionProductRepository, ProductBundleOptionProductRepository $productBundleOptionProductRepository,
ProductImage $productImageHelper,
BundleOption $bundleOptionHelper, BundleOption $bundleOptionHelper,
ProductVideoRepository $productVideoRepository ProductVideoRepository $productVideoRepository
) )
@ -112,7 +109,6 @@ class Bundle extends AbstractType
$attributeValueRepository, $attributeValueRepository,
$productInventoryRepository, $productInventoryRepository,
$productImageRepository, $productImageRepository,
$productImageHelper,
$productVideoRepository $productVideoRepository
); );

View File

@ -3,7 +3,6 @@
namespace Webkul\Product\Type; namespace Webkul\Product\Type;
use Webkul\Checkout\Models\CartItem; use Webkul\Checkout\Models\CartItem;
use Webkul\Product\Helpers\ProductImage;
use Webkul\Product\Repositories\ProductRepository; use Webkul\Product\Repositories\ProductRepository;
use Webkul\Attribute\Repositories\AttributeRepository; use Webkul\Attribute\Repositories\AttributeRepository;
use Webkul\Product\Datatypes\CartItemValidationResult; use Webkul\Product\Datatypes\CartItemValidationResult;
@ -80,7 +79,6 @@ class Downloadable extends AbstractType
* @param \Webkul\Product\Repositories\ProductImageRepository $productImageRepository * @param \Webkul\Product\Repositories\ProductImageRepository $productImageRepository
* @param \Webkul\Product\Repositories\ProductDownloadableLinkRepository $productDownloadableLinkRepository * @param \Webkul\Product\Repositories\ProductDownloadableLinkRepository $productDownloadableLinkRepository
* @param \Webkul\Product\Repositories\ProductDownloadableSampleRepository $productDownloadableSampleRepository * @param \Webkul\Product\Repositories\ProductDownloadableSampleRepository $productDownloadableSampleRepository
* @param \Webkul\Product\Helpers\ProductImage $productImageHelper
* @param \Webkul\Product\Repositories\ProductVideoRepository $productVideoRepository * @param \Webkul\Product\Repositories\ProductVideoRepository $productVideoRepository
* *
* @return void * @return void
@ -93,7 +91,6 @@ class Downloadable extends AbstractType
productImageRepository $productImageRepository, productImageRepository $productImageRepository,
ProductDownloadableLinkRepository $productDownloadableLinkRepository, ProductDownloadableLinkRepository $productDownloadableLinkRepository,
ProductDownloadableSampleRepository $productDownloadableSampleRepository, ProductDownloadableSampleRepository $productDownloadableSampleRepository,
ProductImage $productImageHelper,
ProductVideoRepository $productVideoRepository ProductVideoRepository $productVideoRepository
) )
{ {
@ -103,7 +100,6 @@ class Downloadable extends AbstractType
$attributeValueRepository, $attributeValueRepository,
$productInventoryRepository, $productInventoryRepository,
$productImageRepository, $productImageRepository,
$productImageHelper,
$productVideoRepository $productVideoRepository
); );

View File

@ -9,7 +9,6 @@ use Webkul\Product\Repositories\ProductInventoryRepository;
use Webkul\Product\Repositories\ProductImageRepository; use Webkul\Product\Repositories\ProductImageRepository;
use Webkul\Product\Repositories\ProductVideoRepository; use Webkul\Product\Repositories\ProductVideoRepository;
use Webkul\Product\Repositories\ProductGroupedProductRepository; use Webkul\Product\Repositories\ProductGroupedProductRepository;
use Webkul\Product\Helpers\ProductImage;
use Webkul\Product\Models\ProductAttributeValue; use Webkul\Product\Models\ProductAttributeValue;
use Webkul\Product\Models\ProductFlat; use Webkul\Product\Models\ProductFlat;
@ -59,7 +58,6 @@ class Grouped extends AbstractType
* @param \Webkul\Product\Repositories\ProductInventoryRepository $productInventoryRepository * @param \Webkul\Product\Repositories\ProductInventoryRepository $productInventoryRepository
* @param \Webkul\Product\Repositories\ProductImageRepository $productImageRepository * @param \Webkul\Product\Repositories\ProductImageRepository $productImageRepository
* @param \Webkul\Product\Repositories\ProductGroupedProductRepository $productGroupedProductRepository * @param \Webkul\Product\Repositories\ProductGroupedProductRepository $productGroupedProductRepository
* @param \Webkul\Product\Helpers\ProductImage $productImageHelper
* @param \Webkul\Product\Repositories\ProductVideoRepository $productVideoRepository * @param \Webkul\Product\Repositories\ProductVideoRepository $productVideoRepository
* @return void * @return void
*/ */
@ -70,7 +68,6 @@ class Grouped extends AbstractType
ProductInventoryRepository $productInventoryRepository, ProductInventoryRepository $productInventoryRepository,
ProductImageRepository $productImageRepository, ProductImageRepository $productImageRepository,
ProductGroupedProductRepository $productGroupedProductRepository, ProductGroupedProductRepository $productGroupedProductRepository,
ProductImage $productImageHelper,
ProductVideoRepository $productVideoRepository ProductVideoRepository $productVideoRepository
) )
{ {
@ -80,7 +77,6 @@ class Grouped extends AbstractType
$attributeValueRepository, $attributeValueRepository,
$productInventoryRepository, $productInventoryRepository,
$productImageRepository, $productImageRepository,
$productImageHelper,
$productVideoRepository $productVideoRepository
); );

View File

@ -7,7 +7,6 @@ use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Validation\ValidatesRequests;
use Webkul\Velocity\Helpers\Helper; use Webkul\Velocity\Helpers\Helper;
use Webkul\Product\Helpers\ProductImage;
use Webkul\Product\Repositories\SearchRepository; use Webkul\Product\Repositories\SearchRepository;
use Webkul\Product\Repositories\ProductRepository; use Webkul\Product\Repositories\ProductRepository;
use Webkul\Customer\Repositories\WishlistRepository; use Webkul\Customer\Repositories\WishlistRepository;
@ -26,13 +25,6 @@ class Controller extends BaseController
*/ */
protected $_config; protected $_config;
/**
* ProductImage object
*
* @var \Webkul\Product\Helpers\ProductImage
*/
protected $productImageHelper;
/** /**
* SearchRepository object * SearchRepository object
* *
@ -87,18 +79,16 @@ class Controller extends BaseController
* Create a new controller instance. * Create a new controller instance.
* *
* @param \Webkul\Velocity\Helpers\Helper $velocityHelper * @param \Webkul\Velocity\Helpers\Helper $velocityHelper
* @param \Webkul\Product\Helpers\ProductImage $productImageHelper
* @param \Webkul\Product\Repositories\SearchRepository $searchRepository * @param \Webkul\Product\Repositories\SearchRepository $searchRepository
* @param \Webkul\Product\Repositories\ProductRepository $productRepository * @param \Webkul\Product\Repositories\ProductRepository $productRepository
* @param \Webkul\Category\Repositories\CategoryRepository $categoryRepository * @param \Webkul\Category\Repositories\CategoryRepository $categoryRepository
* @param \Webkul\Velocity\Repositories\Product\ProductRepository $velocityProductRepository * @param \Webkul\Velocity\Repositories\Product\ProductRepository $velocityProductRepository
* @param \Webkul\Velocity\Repositories\VelocityCustomerCompareProductRepository $compareProductsRepository * @param \Webkul\Velocity\Repositories\VelocityCustomerCompareProductRepository $compareProductsRepository
* *
* @return void * @return void
*/ */
public function __construct( public function __construct(
Helper $velocityHelper, Helper $velocityHelper,
ProductImage $productImageHelper,
SearchRepository $searchRepository, SearchRepository $searchRepository,
ProductRepository $productRepository, ProductRepository $productRepository,
WishlistRepository $wishlistRepository, WishlistRepository $wishlistRepository,
@ -114,14 +104,12 @@ class Controller extends BaseController
$this->productRepository = $productRepository; $this->productRepository = $productRepository;
$this->productImageHelper = $productImageHelper;
$this->categoryRepository = $categoryRepository; $this->categoryRepository = $categoryRepository;
$this->wishlistRepository = $wishlistRepository; $this->wishlistRepository = $wishlistRepository;
$this->velocityProductRepository = $velocityProductRepository; $this->velocityProductRepository = $velocityProductRepository;
$this->compareProductsRepository = $compareProductsRepository; $this->compareProductsRepository = $compareProductsRepository;
} }
} }