Add seller product deletion

This commit is contained in:
Shohrat 2023-09-15 00:14:45 +05:00
parent 84dd5dd1b8
commit fecfddc180
2 changed files with 12 additions and 3 deletions

View File

@ -43,13 +43,14 @@ class SellerProduct extends SellerProductController
/** /**
* Create a new controller instance. * Create a new controller instance.
* $categoryRepository * $categoryRepository
* @param \Webkul\Product\Repositories\ProductRepository $productAttributeValueRepository * @param \Webkul\Product\Repositories\ProductRepository $productAttributeValueRepository
* @return void * @return void
*/ */
public function __construct( public function __construct(
ProductRepository $productRepository, ProductRepository $productRepository,
SellerRepository $sellerRepository, SellerRepository $sellerRepository,
) { )
{
$this->_config = request('_config'); $this->_config = request('_config');
$this->productRepository = $productRepository; $this->productRepository = $productRepository;
$this->sellerRepository = $sellerRepository; $this->sellerRepository = $sellerRepository;
@ -97,6 +98,7 @@ class SellerProduct extends SellerProductController
]); ]);
} }
} }
public function sellerOrderDetail(Request $request) public function sellerOrderDetail(Request $request)
{ {
$validation = Validator::make($request->all(), [ $validation = Validator::make($request->all(), [
@ -332,4 +334,10 @@ class SellerProduct extends SellerProductController
]); ]);
} }
} }
public function deleteProduct($product_id)
{
$this->productRepository->delete($product_id);
return response()->json(['success' => true]);
}
} }

View File

@ -44,6 +44,7 @@ Route::group(['prefix' => 'api'], function () {
Route::get('products/{vendor_id}/{product_id}',[Vendors::class,'sellerProductsById']); Route::get('products/{vendor_id}/{product_id}',[Vendors::class,'sellerProductsById']);
Route::post('create/product', [SellerProduct::class, 'storeSellerProd']); Route::post('create/product', [SellerProduct::class, 'storeSellerProd']);
Route::post('update/product', [SellerProduct::class, 'updateProductFlat']); Route::post('update/product', [SellerProduct::class, 'updateProductFlat']);
Route::post('delete/product/{product_id}', [SellerProduct::class, 'deleteProduct']);
}); });
Route::group(['middleware' => ['locale', 'currency']], function () { Route::group(['middleware' => ['locale', 'currency']], function () {