Invoices
To
@php
$columns = [
['label' => '#', 'column' => 'id', 'sort' => false],
['label' => 'Order Id', 'column' => 'order_no', 'sort' => true],
['label' => 'Invoice No', 'column' => 'invoice_no', 'sort' => true],
['label' => 'Customer name', 'column' => 'first_name', 'sort' => true],
['label' => 'Invoice Date', 'column' => 'invoice_date', 'sort' => true],
['label' => 'Shipping method', 'column' => 'shipping_method', 'sort' => true],
['label' => 'Sub total', 'column' => 'total_amount', 'sort' => true],
['label' => 'Grand total', 'column' => 'grand_total', 'sort' => true],
['label' => 'Actions', 'column' => 'action', 'sort' => false],
];
@endphp
@foreach ($orders as $key => $item)
{{ $loop->iteration }}
#{{ $item->order_no ?? ('PM-' . (1000 + $item->id)) }}
#{{ $item->invoice_no ?? ('PM-INV-' . (1000 + $item->id)) }}
{{ $item->first_name . ' ' . $item->last_name }}
{{ \Carbon\Carbon::parse($item->invoice_date)->format('d-m-Y') }}
{{ $item->shipping_method }}
$ {{ number_format($item->total_amount ?? 0, 2) }}
$ {{ number_format($item->grand_total ?? 0, 2) }}
@endforeach