@extends('layouts/layout') @section('content')
@php $images = $product->images->groupBy('color_id'); @endphp @foreach ($images as $colorId => $colorImages)
@foreach ($colorImages->chunk(2) as $chunk)
@foreach ($chunk as $img)
Product Image
@endforeach
@endforeach
@endforeach
{{ $product->name }}

Rs. {{ number_format($product->price, 2) }} Rs. {{ number_format($product->price - $product->discount, 2) }} Save Rs.{{ number_format($product->discount, 2) }}

@php $groupedImagesByColor = $product->images->groupBy('color_id'); @endphp
Color: {{ $colors->first()->color_name ?? '' }}
@foreach ($groupedImagesByColor as $colorId => $images) @php $color = $colors->firstWhere('id', $colorId); $firstImage = $images->first(); @endphp @endforeach
Size :
@php $sizes = explode(',', $product->size); @endphp @foreach ($sizes as $size) @endforeach

Estimated delivery between 03 June - 09 June.

@php $quantity = $cartItems[$product->id] ?? 0; @endphp
@if ($quantity > 0)
@else Add to Cart @endif

{!! $product->description !!}

@auth @if($canReview) Write your Review @endif @endauth
Customer reviews
@forelse($reviews as $review)
{{ $review->user->name ?? 'Anonymous' }} {!! str_repeat('★', $review->rating) !!} {!! str_repeat('☆', 5 - $review->rating) !!}
{{ $review->review }} @if (!empty($review->image_path)) @php $images = is_array($review->image_path) ? $review->image_path : json_decode($review->image_path, true); @endphp
@foreach ($images as $img) review image @endforeach
@endif

@empty

No reviews available for this product yet.

@endforelse
@auth @if($canReview)
@csrf
Customer reviews
@for ($i = 5; $i >= 1; $i--) @endfor
@endif @endauth
Similar Products
@foreach($similarProducts as $similar) @php $images = explode(',', $similar->image); $firstImage = $images[0] ?? null; @endphp
{{ $similar->name }}
{{ $similar->name }}

Rs. {{ number_format($similar->price, 2) }} Rs. {{ number_format($similar->price - $similar->discount, 2) }}

@endforeach
@endsection