@extends('frontend.layouts.master') @section('meta') @php use Illuminate\Support\Str; // Split photo field (comma-separated) $photos = array_filter(array_map('trim', explode(',', $product_detail->photo ?? ''))); $firstPhoto = $photos[0] ?? null; // Make sure it's an absolute URL $ogImage = $firstPhoto ? (Str::startsWith($firstPhoto, ['http://','https://']) ? $firstPhoto : url($firstPhoto)) : asset('frontend/images/share-fallback-1200x630.jpg'); // fallback if no product image $canonical = route('product-detail', $product_detail->slug); $plainDesc = Str::limit(strip_tags($product_detail->summary ?: $product_detail->description), 150); $title = $product_detail->title; @endphp {{-- Core/SEO --}} {{-- Open Graph (Facebook/WhatsApp/LinkedIn) --}} {{-- Twitter --}} {{-- JSON-LD Product --}} @endsection @section('title','JAYAKA || PRODUCT DETAIL') @section('main-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 $after_discount=($product_detail->price-(($product_detail->price*$product_detail->discount)/100)); @endphp

Rs{{number_format($after_discount,2)}}Rs{{number_format($product_detail->price,2)}}

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

{{--

Available Options Color

--}}
@csrf @guest @else @endguest @php $isGuest = Auth::guest(); @endphp

Category :{{$product_detail->cat_info['title']}}

@if($product_detail->sub_cat_info)

Sub Category :{{$product_detail->sub_cat_info['title']}}

@endif

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

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

Add A Review

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

Your Rating *

@auth
@csrf {{-- optional: also pass slug in body if your controller reads $request->slug --}}
@error('rate') {{ $message }} @enderror
{{-- Photos (optional) --}}
Click to upload or drag & drop
Up to 5 images • JPG/PNG/WebP • 2MB each
@error('photos')
{{ $message }}
@enderror @error('photos.*')
{{ $message }}
@enderror
@else

You need to Login OR Register

@endauth
{{-- @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)
@if($data->user_info['photo']) {{ $data->user_info['photo'] }} @else Profile.jpg @endif
{{-- Review Photos --}} @if($data->photos && $data->photos->count())
@foreach($data->photos as $photo) @endforeach
@endif
{{ $data->user_info['name'] }}
    @for($i=1; $i<=5; $i++) @if($data->rate >= $i)
  • @else
  • @endif @endfor
({{ $data->rate }})

{{ $data->review }}

@endforeach {{-- One shared modal to preview images --}}
@endsection @push('styles') @endpush @push('scripts') {{-- --}} @endpush @push('scripts') @endpush