@extends('Branch.layout') @section('content')
{{-- Header --}}
@if (!empty($category->image_url)) {{ $category->category }} @endif
{{ $category->category }}
Category Products
{{-- Products --}}
Products {{ $products->count() }}
@forelse ($products as $index => $product) @php $productImage = null; if (!empty($product->product_image)) { $decodedImages = json_decode( $product->product_image, true ); if ( is_array($decodedImages) && !empty($decodedImages) ) { $firstImage = $decodedImages[0]; if ( str_starts_with( $firstImage, 'http://' ) || str_starts_with( $firstImage, 'https://' ) ) { $productImage = $firstImage; } elseif ( str_starts_with( $firstImage, 'storage/' ) ) { $productImage = asset( $firstImage ); } else { $productImage = asset( 'storage/' . ltrim( $firstImage, '/' ) ); } } else { $singleImage = $product->product_image; if ( str_starts_with( $singleImage, 'http://' ) || str_starts_with( $singleImage, 'https://' ) ) { $productImage = $singleImage; } elseif ( str_starts_with( $singleImage, 'storage/' ) ) { $productImage = asset( $singleImage ); } else { $productImage = asset( 'storage/' . ltrim( $singleImage, '/' ) ); } } } @endphp @empty @endforelse
S.No Product Product Code Weight Machine ID Price Stock
{{ $index + 1 }} {{ $product->product_name ?? '-' }} {{ $product->product_id ?? '-' }} {{ $product->weight_machine_id ?? '-' }} ₹{{ number_format( (float) ($product->price ?? 0), 2 ) }} @if ((float) $product->stock > 0) {{ $product->stock }} @else Out of Stock @endif
No active products found under this category.
@endsection