fix: prevent error on admin orders list when customer is deleted

Add null check on ``$order->customer`` in ``OrdersDataTable`` to display
"Client supprimé" instead of crashing when the related customer record
no longer exists.
This commit is contained in:
Valentin Lab
2026-02-20 11:38:13 +01:00
parent e4540f9d88
commit 7e9c3c6196

View File

@@ -35,7 +35,9 @@ class OrdersDataTable extends DataTable
return $order->created_at->format('d/m/Y H:i:s');
})
->editColumn('customer.last_name', function (Order $order) {
return $order->customer->last_name.' '.$order->customer->first_name;
return $order->customer
? $order->customer->last_name.' '.$order->customer->first_name
: 'Client supprimé';
})
->editColumn('payment_type', function (Order $order) {
return InvoicePayments::getPaymentType($order->payment_type);