@php $currency_symbol = isset($settingsData['currency_symbol']) && $settingsData['currency_symbol'] ? $settingsData['currency_symbol'] : ''; @endphp @if(isset($listing) && count($listing) > 0 ) @foreach($listing->items() as $k => $p) @php $totalReview = DB::table('user_reviews')->where('product_id', $p->id)->whereNotNull('review')->pluck('id')->count(); $totalRating = DB::table('user_reviews')->where('product_id', $p->id)->pluck('rating')->sum(); $averageRating = DB::table('user_reviews')->where('product_id', $p->id)->avg('rating'); $totalProReview = DB::table('user_reviews')->where('product_id', $p->id)->pluck('id')->count(); $averageRating = isset($averageRating) && $averageRating ? number_format($averageRating, 1) : 0; @endphp