@if(count($product->reviews) > 0) @if(count($product->reviews->where('approved', 1)->where('rating', '!=', null)) > 0)
@if(count($product->reviews->where('approved', 1)) > 0)

{{$product->reviews->where('approved', 1)->where('rating', '!=', null)->avg('rating')}}

{{count($product->reviews->where('approved', 1)->where('rating', '!=', null))}} @lang('Ratings &') {{count($product->reviews->where('approved', 1)->where('comment', '!=', null))}} @lang('Reviews')
@endif

@lang('Reviews & Ratings')

5
{{(count($product->reviews->where('approved', 1)->where('rating', 5)) / count($product->reviews->where('approved', 1)->where('rating', '!=', null))) * 100}}% Complete (danger)
{{count($product->reviews->where('approved', 1)->where('rating', 5))}}
4
{{(count($product->reviews->where('approved', 1)->where('rating', 4)) / count($product->reviews->where('approved', 1)->where('rating', '!=', null))) * 100}}% Complete (danger)
{{count($product->reviews->where('approved', 1)->where('rating', 4))}}
3
{{(count($product->reviews->where('approved', 1)->where('rating', 3)) / count($product->reviews->where('approved', 1)->where('rating', '!=', null))) * 100}}% Complete (danger)
{{count($product->reviews->where('approved', 1)->where('rating', 3))}}
2
{{(count($product->reviews->where('approved', 1)->where('rating', 2)) / count($product->reviews->where('approved', 1)->where('rating', '!=', null))) * 100}}% Complete (danger)
{{count($product->reviews->where('approved', 1)->where('rating', 2))}}
1
{{(count($product->reviews->where('approved', 1)->where('rating', 1)) / count($product->reviews->where('approved', 1)->where('rating', '!=', null))) * 100}}% Complete (danger)
{{count($product->reviews->where('approved', 1)->where('rating', 1))}}
@endif
@include('includes.approved_reviews', ['reviews' => $product->reviews()->where('approved', 1)->orderBy('id', 'desc')->paginate(5)])
@if(Auth::check()) @foreach($product->reviews->where('approved', 0)->where('user_id', Auth::user()->id) as $review)

{{$review->user->name}} @php $empty_stars = 5 - $review->rating; @endphp @for($i=1; $i <= $review->rating; $i++) @endfor @for($i=1; $i <= $empty_stars; $i++) @endfor @if($review->user_id == Auth::user()->id) @lang('Edit Review') @endif

{{$review->created_at->toFormattedDateString()}}

@lang('Pending for approval from administrators')

{{$review->comment}}

@endforeach @endif @else

@lang('There are no reviews.')

@endif