$order_info = DB::table('order_assignments')
->join('order', 'order_assignments.order_id', '=', 'order.id')
->join('order_status', 'order.order_status_id', '=', 'order_status.order_status_id')
->join('users', 'order.customer_id', '=', 'users.id')
->join('address', 'order.address_id', '=', 'address.id')
->where('delivery_boy_id', $delivery_boy_id)
->where('is_accept', 1)
->whereRaw('order_assignments.delivery_completed_at < order_assignments.time_of_assignment')
->get();
//dd($order_info);
if ($order_info) {
foreach ($order_info as $value1) {
$value = $value1;
$orderModel = new Order();
$order_info = $orderModel->getOrderDetailsForId($value->order_id);
$this->response['bill']= ['item' =>$order_info['orderDishes'],'service_charge' => $value->total_sercharge, 'total_amount' => $value->total_amount, 'comment' => 'completed on time', 'customer'=>['address' => $value->address, 'Name' => $value->name], 'distance_traveled' =>'7 k.m', 'picker' => 1, 'restaurant' =>['address' => 'c-3', 'lat' => '77.2222', 'long' => '77025698'], 'time_taken'=> '2hours', 'status' => 'completed', 'uid' => $value->order_id ];
}
// $this->response['customer'] = ['address' => $value->address ];
return json_encode($this->response);
}
}
When i run this code its apperaring only last order id from databse in jason respose while there are two order id are in table. Please anyone help me to fix this problem
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire