Change following code in /app/Http/Controllers/DeliveryController.php
you can make $commission static here.
$deliveryGuyNewOrders = collect();
foreach ($orders as $order) {
$commission = 0;
if (config('appSettings.deliveryGuyCommissionFrom') == 'FULLORDER') {
$commission = $deliveryGuyCommissionRate / 100 * $order->total;
}
if (config('appSettings.deliveryGuyCommissionFrom') == 'DELIVERYCHARGE') {
$commission = $deliveryGuyCommissionRate / 100 * $order->delivery_charge;
}
$order->commission = number_format((float) $commission, 2, '.', '');
foreach ($userRestaurants as $ur) {
//checking if delivery guy is assigned to that restaurant
if ($order->restaurant->id == $ur->id) {
$deliveryGuyNewOrders->push($order);
}
}
}