@if (\App\BusinessSetting::where('type', 'vendor_system_activation')->first()->value == 1) @php $array = array(); $sellerList = \App\Seller::with('user_product')->where('verification_status', 1)->where('featured_status', '1')->get(); $count = count($sellerList); if(count($sellerList) >= 20){ $rows = $sellerList; }else{ $remain = 20 - count($sellerList); $seller = \App\Seller::where('verification_status', 1)->where('featured_status', '1'); $sellerVerify = \App\Seller::where('verification_status', 1)->take($remain); $rows = $seller->union($sellerVerify)->get(); } foreach ($sellerList as $key => $seller) { if($seller->user_product != null){ $total_sale = 0; foreach ($seller->user_product as $key => $product) { $total_sale += $product->num_of_sale; } $array[$seller->id] = $total_sale; } } arsort($array); $array = array_slice($array, 0, 6, true); //dd($array); @endphp @if(!empty($array))
@endif @endif