@forelse($item->attributes as $attribute)
{{ $attribute->name }}
{{ number_format($attribute->average_rating, 1) }}
@for($i = 1; $i <= 5; $i++)
@if($i <= round($attribute->average_rating))
@else
@endif
@endfor
({{ $attribute->ratings_count }} ratings)
{{-- Rating breakdown bars --}}
@foreach(range(5, 1) as $rating)
@php
$count = $attribute->ratings()->where('rating', $rating)->count();
$percentage = $attribute->ratings_count > 0
? ($count / $attribute->ratings_count) * 100
: 0;
@endphp
{{ $rating }} stars
{{ $count }}
@endforeach
@if(!$loop->last)
@endif
@empty
No attributes defined
@endforelse