@extends('front::layouts.master') @section('SOE') {{$product_detail->title ?? ''}} || PRODUCT DETAIL @endsection @section('content')

{{$product_detail->title}}

@php $rate=ceil($product_detail->getReview->avg('rate')) @endphp
    @for($i=1; $i<=5; $i++) @if($rate>=$i)
  • @else
  • @endif @endfor
({{$product_detail['getReview']->count()}}) Review
@php $price = $product_detail->price; $discount = $product_detail->discount ?? 0; $specialPrice = $product_detail->special_price ?? null; $finalPrice = $specialPrice ? $specialPrice : ($price - (($price * $discount) / 100)); @endphp

${{ number_format($finalPrice, 2) }} @if($finalPrice < $price) ${{ number_format($price, 2) }} @endif

{!!($product_detail->summary)!!}

@php // Support both Eloquent object and array structure (for future-proofing) $attributes = []; if(isset($product_detail->attributes) && is_array($product_detail->attributes) && count($product_detail->attributes)) { $attributes = $product_detail->attributes; } elseif(!empty($product_detail->attributeValues)) { foreach($product_detail->attributeValues as $attrVal) { $attr = is_object($attrVal->attribute) ? $attrVal->attribute : null; if(!$attr) continue; $value = $attrVal->text_value ?? $attrVal->string_value ?? $attrVal->integer_value ?? $attrVal->float_value ?? $attrVal->boolean_value ?? $attrVal->date_value ?? $attrVal->decimal_value ?? $attrVal->url_value ?? $attrVal->hex_value ?? null; $attributes[] = [ 'attribute' => [ 'name' => $attr->name, 'label' => $attr->display, 'type' => $attr->type, ], 'value' => $value, ]; } } @endphp @if(count($attributes))

Product Attributes

    @foreach($attributes as $attributeValue) @php $attr = $attributeValue['attribute'] ?? null; $value = $attributeValue['value'] ?? null; @endphp @if($attr && $value)
  • {{ ucfirst($attr['name'] ?? $attr['label'] ?? '') }} {{ $value }}
  • @endif @endforeach
@endif
@csrf
Quantity :

Category : @foreach($product_detail->categories as $category) {{$category->title}} @endforeach

Stock : @if($product_detail->stock>0) {{$product_detail->stock}} @else {{$product_detail->stock}} @endif

@php $reviews = $product_detail->getReview; $reviewCount = $reviews->count(); @endphp

{!! ($product_detail->description) !!}

Add A Review

Your email address will not be published. Required fields are marked

Your Rating *

@auth
@csrf
@error('rate') {{$message}} @enderror
@else

You need to Login OR Register

@endauth
@php $averageRating = $reviewCount ? round($reviews->avg('rate'), 1) : 0; @endphp

Customer Reviews

@for($i = 1; $i <= 5; $i++) @if($i <= floor($averageRating)) @elseif($i - $averageRating < 1) @else @endif @endfor
{{ $averageRating }} / 5 ({{ $reviewCount }} review{{ $reviewCount != 1 ? 's' : '' }})
@forelse($reviews as $review)
{{ $review->user->name ?? 'Anonymous' }} @for($i = 1; $i <= 5; $i++) @endfor {{ $review->created_at ? $review->created_at->format('Y-m-d') : '' }}
{{ $review->review }}
@empty

No reviews yet. Be the first to review this product!

@endforelse
{{-- @php $rate=0; foreach($product_detail->rate as $key=>$rate){ $rate +=$rate } @endphp --}}

{{ceil($product_detail->getReview->avg('rate'))}} (Overall)

Based on {{$product_detail->getReview->count()}} Comments
@foreach($product_detail['getReview'] as $data)
@php $userPhoto = $data->user?->getFirstMediaUrl('photo') ?: asset('backend/img/avatar.png'); @endphp {{ $data->user?->name }}
{{$data->user['name']}}
    @for($i=1; $i<=5; $i++) @if($data->rate>=$i)
  • @else
  • @endif @endfor
({{$data->rate}})

{{$data->review}}

@endforeach
@endsection @push('styles') @endpush @push('scripts') @endpush