api seller order
This commit is contained in:
parent
a41825813c
commit
555b151f78
|
|
@ -2,13 +2,11 @@
|
|||
|
||||
namespace Sarga\API\Http\Controllers;
|
||||
|
||||
use DB;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Sarga\API\Http\Resources\Customer\CustomerResource;
|
||||
use Webkul\Customer\Repositories\CustomerAddressRepository;
|
||||
use Webkul\Customer\Repositories\CustomerGroupRepository;
|
||||
use Webkul\Customer\Repositories\CustomerRepository;
|
||||
use Illuminate\Support\Str;
|
||||
use Webkul\Marketplace\Http\Controllers\Shop\Account\ProductController as SellerProductController;
|
||||
|
|
@ -16,7 +14,9 @@ use Webkul\Product\Models\ProductFlat;
|
|||
use Webkul\Product\Models\ProductInventory;
|
||||
use Webkul\Product\Models\Product;
|
||||
use Webkul\Product\Repositories\ProductRepository;
|
||||
use Webkul\Marketplace\Repositories\SellerRepository;
|
||||
use Webkul\Marketplace\Models\Product as SellerProductModel;
|
||||
use Webkul\Marketplace\Models\Order as SellerOrderModel;
|
||||
|
||||
class SellerProduct extends SellerProductController
|
||||
{
|
||||
|
|
@ -39,7 +39,7 @@ class SellerProduct extends SellerProductController
|
|||
*/
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* $categoryRepository
|
||||
* @param \Webkul\Product\Repositories\ProductRepository $productAttributeValueRepository
|
||||
|
|
@ -47,15 +47,58 @@ class SellerProduct extends SellerProductController
|
|||
*/
|
||||
public function __construct(
|
||||
ProductRepository $productRepository,
|
||||
SellerRepository $sellerRepository,
|
||||
) {
|
||||
$this->_config = request('_config');
|
||||
$this->productRepository = $productRepository;
|
||||
|
||||
$this->sellerRepository = $sellerRepository;
|
||||
}
|
||||
|
||||
|
||||
public function sellerOrders(Request $request)
|
||||
{
|
||||
$validation = Validator::make($request->all(), [
|
||||
'seller_id' => 'required',
|
||||
'user' => 'required',
|
||||
'password' => 'required',
|
||||
]);
|
||||
|
||||
|
||||
if ($validation->fails()) {
|
||||
return response()->json(['errors' => $validation->getMessageBag()->all()], 422);
|
||||
}
|
||||
|
||||
$user = $request->get('user');
|
||||
$pass = $request->get('password');
|
||||
|
||||
if ($user == "romanah_" && $pass == "bt110226$$") {
|
||||
|
||||
$seller = $this->sellerRepository->isSellerMarket($request->get('seller_id'));
|
||||
|
||||
if ($seller) {
|
||||
|
||||
$orders = SellerOrderModel::where('marketplace_seller_id', $seller->id)->paginate(12);
|
||||
// \Log::info($seller);
|
||||
|
||||
return response([
|
||||
'status' => 200,
|
||||
'data' => $orders,
|
||||
'message' => 'succesfully updated product'
|
||||
]);
|
||||
} else {
|
||||
return response([
|
||||
'status' => 500,
|
||||
'message' => 'not found seller'
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
return response([
|
||||
'status' => 500,
|
||||
'message' => 'not authorized'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function storeSellerProd(Request $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ class Vendors extends V1Controller
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function sources(){
|
||||
$vendors = $this->vendorRepository->select('marketplace_sellers.id','url','shop_title')
|
||||
->where('is_approved',true)
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ Route::post('admin/romanah/login', [AuthController::class, 'login']);
|
|||
Route::group(['prefix' => 'api'], function () {
|
||||
|
||||
Route::group(['prefix' => 'seller'],function (){
|
||||
Route::post('orders',[SellerProduct::class, 'sellerOrders']);
|
||||
|
||||
Route::get('products/{vendor_id}',[Vendors::class,'sellerProducts']);
|
||||
Route::post('create/product', [SellerProduct::class, 'storeSellerProd']);
|
||||
Route::post('update/product', [SellerProduct::class, 'updateProductFlat']);
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ class SellerRepository extends Repository
|
|||
|
||||
public function isSellerMarket($sellerId)
|
||||
{
|
||||
$seller = $this->getModel()->where('id', $sellerId)->first();
|
||||
$seller = $this->getModel()->where('id', $sellerId)->where('is_approved', 1)->first();
|
||||
|
||||
return $seller;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue