@extends('frontend.layouts.app') @section('content')
@foreach ($shops as $key => $shop) @php $total = 0; $rating = 0; foreach ($shop->user->products as $key => $shop_product) { $total += $shop_product->reviews->count(); $rating += $shop_product->reviews->sum('rating'); } @endphp

{{ $shop->name }}

@if ($total > 0) {{ renderStarRating($rating/$total) }} @else {{ renderStarRating(0) }} @endif
{{ translate('Visit Store') }}
@endforeach
{{ $shops->links() }}
@endsection