@extends('layouts.app') @section('page-title', $item->title) @section('page-heading', $item->title) @push('styles') @endpush @section('content')
Rating Summary
@foreach($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 }})
@foreach(range(5, 1) as $star) @php $count = $attribute->ratings()->where('rating', $star)->count(); $percentage = $attribute->ratings_count > 0 ? ($count / $attribute->ratings_count) * 100 : 0; @endphp
{{ $star }} star
{{ $count }}
@endforeach
@if($loop->iteration % 2 == 0)
@endif @endforeach
Item Details
Status
{{ $item->status ? 'Active' : 'Inactive' }}
Created
{{ $item->created_at->format('M d, Y') }}
Expires
{{ $item->expires_at?->format('M d, Y') ?? 'Never' }}
Total Ratings
{{ $item->ratings->count() }}
Actions
@if($item->ratings_count === 0)
@csrf @method('DELETE')
@endif Back to List
Recent Reviews
@foreach($item->attributes as $attribute) @endforeach @foreach($item->ratings()->latest()->get() as $rating) @foreach($item->attributes as $attribute) @endforeach @endforeach
Date Reviewer Location{{ $attribute->name }}Comment
{{ $rating->created_at->format('M d, Y H:i') }} {{ $rating->rater_name }} {{ $rating->location ?? '-' }} @php $attrRating = $rating->attributeRatings ->where('rateable_attribute_id', $attribute->id) ->first(); @endphp {{ $attrRating ? $attrRating->rating : '-' }} {{ $rating->comment ?? '-' }}
@include('ratings.partials.share-modal') @push('scripts') @endpush @endsection