@extends('layouts.admin')
@section('content')
Shop Ratings
| Shop |
Rating |
Total Ratings |
@forelse ($ratings->groupBy('shop_id') as $shopId => $shopRatings)
@php
// Retrieve shop details based on shop_id
$shop = \App\Models\User::where('role_as', 2)
->where('id', $shopId)
->with('shop')
->first(); // Assuming shop details are stored in the shops table
// Calculate overall rating for the shop
$overallRating = $shopRatings->avg('shop_rating');
// Count total ratings for the shop
$totalRatings = $shopRatings->count();
@endphp
| {{ $shop->shop->shop_name ?? 'No Name Available' }} |
@if ($overallRating)
{{ number_format($overallRating, 2) }} / 5.0
@else
No rating yet.
@endif
|
{{ $totalRatings }} |
@empty
| No ratings available. |
@endforelse
@endsection