@php /** @var \App\Models\Order $order */ $items = []; $totalValue = (float) $order->total; foreach ($order->items as $row) { $price = $row->product_price ?? 0; $qty = $row->qty ?? 1; $items[] = [ 'item_id' => (string) $row->product_id, 'item_name' => (string) ($row->product_name ?? $row->product->name ?? 'Product'), 'affiliation' => config('app.name', 'MyCommerce'), 'item_brand' => config('app.name', 'MyCommerce'), 'item_category' => (string) ($row->product->category->name ?? ''), 'price' => (float) $price, 'quantity' => (int) $qty, ]; } $shipping = (float) ($order->delivery_charge ?? 0); $tax = 0; // jodi tax column thake, sekhan theke nao @endphp