@php
$specs = $item->product_specs;
$specCount = 0;
$maxSpecs = 10;
@endphp
@if(is_array($specs))
@foreach($specs as $categoryOrKey => $valueOrSpecs)
@if($specCount >= $maxSpecs) @break @endif
@if(is_array($valueOrSpecs))
{{-- Nested structure --}}
{{ $categoryOrKey }}
@foreach($valueOrSpecs as $key => $value)
@if($value && $specCount < $maxSpecs)
{{ $key }}:
{{ is_array($value) ? implode(', ', $value) : $value }}
@php $specCount++; @endphp
@endif
@endforeach
@else
{{-- Flat structure --}}
@if($valueOrSpecs && $specCount < $maxSpecs)
{{ $categoryOrKey }}:
{{ is_array($valueOrSpecs) ? implode(', ', $valueOrSpecs) : $valueOrSpecs }}
@php $specCount++; @endphp
@endif
@endif
@endforeach
@if($specCount >= $maxSpecs)
+ More Specifications
@endif
@endif