@extends('frontend.layout.app') @section('content')

@if(isset($categories) && isset($ageGroup) && $categories->firstWhere('id', $ageGroup)) {{ $categories->firstWhere('id', $ageGroup)->age_range }} @else Products by Age @endif

  • Home
  • @if(isset($categories) && isset($ageGroup) && $categories->firstWhere('id', $ageGroup)) {{ $categories->firstWhere('id', $ageGroup)->age_range }} @else Products by Age @endif
@if($products->count() > 0) @foreach ($products as $product)
@php $ageProductSp = $product->sp ?? 0; $ageProductGst = $product->gst ?? 0; $ageProductPriceWithGst = $ageProductSp + ($ageProductSp * $ageProductGst / 100); @endphp
₹{{ number_format($ageProductPriceWithGst, 2) }} ₹{{ $product->mrp }}.00 ({{ $ageProductGst }}% GST)

{{ $product->product_name }}

@php $ratings = $product->reviews->pluck('rating'); $avgRating = $ratings->count() ? round($ratings->avg(), 2) : null; $ratingPercent = $avgRating ? ($avgRating / 5) * 100 : 0; @endphp @auth
@if(session('success')) @endif @if($product->available_stock > 0)
@csrf
@else @endif @php $sessionId = session()->getId(); @endphp
@csrf
@endauth
@endforeach @else
No products found for this age group.
@endif
@endsection