This commit is contained in:
Shohrat 2023-09-12 17:41:56 +05:00
commit e3dce350d7
4 changed files with 13 additions and 12 deletions

View File

@ -277,8 +277,7 @@ class SellerProduct extends SellerProductController
//$images = json_decode($request['images']['files'][0]); //$images = json_decode($request['images']['files'][0]);
//\Log::info($images); //\Log::info($images);
//\Log::info($request->all()); //\Log::info($request->all());
\Log::info($request['images']);
\Log::info($request['surats']);
// dd($request->get('images')); // dd($request->get('images'));
// dd($request['images']); // dd($request['images']);
$data = array( $data = array(

View File

@ -65,17 +65,18 @@ class Vendors extends V1Controller
public function index() public function index()
{ {
$vendors = $this->vendorRepository->select('marketplace_sellers.id','url','logo','banner','shop_title','brand_attribute_id','ship_time','ship_price','slogan') $vendors = $this->vendorRepository->select('marketplace_sellers.id','url','logo','banner','shop_title', 'ship_time','ship_price','slogan')
->where('is_approved',true) ->where('is_approved',true)
->with(['categories:seller_id,categories']) ->with(['categories:seller_id,categories'])
// ->leftJoin('seller_categories','marketplace_sellers.id','=','seller_categories.seller_id') // ->leftJoin('seller_categories','marketplace_sellers.id','=','seller_categories.seller_id')
->get(); ->paginate(15);
$reviewed_vendors = $vendors->map(function ($item, $key){
$item->review_average = $this->reviewRepository->getAverageRating($item);
return $item;
});
return Vendor::collection($reviewed_vendors); // $reviewed_vendors = $vendors->map(function ($item, $key){
// $item->review_average = $this->reviewRepository->getAverageRating($item);
// return $item;
// });
return Vendor::collection($vendors);
} }
public function products(ProductRepository $productRepository,$seller_id){ public function products(ProductRepository $productRepository,$seller_id){

View File

@ -51,12 +51,13 @@ class Product extends JsonResource
'in_stock' => $product->haveSufficientQuantity(1), 'in_stock' => $product->haveSufficientQuantity(1),
'is_wishlisted' => $this->isWishlisted($product) , 'is_wishlisted' => $this->isWishlisted($product) ,
'is_item_in_cart' => \Cart::hasProduct($product), 'is_item_in_cart' => \Cart::hasProduct($product),
//'shop_title' => $this->shop_title, 'shop_title' => $this->shop_title,
//'logo' => $this->logo ? Storage::url($this->logo) : null, 'logo' => $this->logo ? Storage::url($this->logo) : null,
'new' => $this->new, 'new' => $this->new,
'featured' => $this->featured, 'featured' => $this->featured,
'qty' => $this->qty, 'qty' => $this->qty,
'status' => $this->status, 'status' => $this->status,
'product_number' => $this->product_number,
// 'brand' => $product->brand->name ?? '', // 'brand' => $product->brand->name ?? '',

View File

@ -23,7 +23,7 @@ class Vendor extends JsonResource
'banner' => $this->banner_url, 'banner' => $this->banner_url,
'ship_price' => $this->ship_price, 'ship_price' => $this->ship_price,
'ship_time' => $this->ship_time, 'ship_time' => $this->ship_time,
'review_average' => $this->review_average, // 'review_average' => $this->review_average,
'slogan' => $this->slogan, 'slogan' => $this->slogan,
// 'brand_id' => $this->brand_attribute_id, // 'brand_id' => $this->brand_attribute_id,
// $this->mergeWhen(!empty($this->main_categories) && $this->main_categories->count(),[ // $this->mergeWhen(!empty($this->main_categories) && $this->main_categories->count(),[