@if($show) @foreach($attributes as $attribute) @endforeach @endif @foreach($variantAttributes as $variantAttribute) @php $cloned = clone $variants; $filtered = $cloned->whereHas('attributes', function ($query) use ($variantAttribute) { $query->where('attribute_value_id', $variantAttribute); })->pluck('id')->toArray(); $items = App\Models\OrderItem::whereIn('variant_id', $filtered)->where('order_id', $orderId)->get(); if($items->isEmpty()){ dd($filtered); } @endphp @foreach($items as $item) @foreach($attributes as $attribute) @php // $variant_id = App\Models\OrderItem::find($item['order_item_id'])->variant_id; $variant = App\Models\Variant::find($item->variant_id); $variantvalues = App\Models\VariantAttribute::where('variant_id', $variant->id)->where('attribute_id', $attribute->id)->first(); @endphp @if($variantvalues) @else @endif @endforeach @endforeach @endforeach
Item Name{{ $attribute->name }}qty
Customer Name:{{ $order->debitLedger->name }} Delivery Date : {{ $order->delivery_date }}
@php $name = App\Models\StockItem::find($item['stock_item_id'])->name; @endphp {{ $name }}{{ $variantvalues->attributeValue->value }}{{ $item['quantity'] }}
Total {{ $items->sum('quantity') }}