Skip to content

Commit bc04f7a

Browse files
committed
Update order retrieval logic to exclude taken orders in GetOrderOfTownController and GetPreferenceOrderController
This commit modifies the order retrieval queries in both GetOrderOfTownController and GetPreferenceOrderController to filter out orders that have been marked as taken. This change ensures that only available orders are returned in the API responses, improving the accuracy of order listings.
1 parent 01b5c02 commit bc04f7a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

app/Http/Controllers/Delivery/GetOrderOfTownController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function getOrderInQuarter($residence_id){
3434
->where('quarter_name', $quarterInresidence->quarter_name)
3535
->first();
3636

37-
$orders=Order::with('user')->where('fee_of_shipping',"!=",0)->where('status',"!=","2")->orderBy('created_at','desc')->where('quarter_delivery',$quarterUser->quarter_name)->get();
37+
$orders=Order::with('user')->where('fee_of_shipping',"!=",0)->where('status',"!=","2")->where('isTake',"!=",1)->orderBy('created_at','desc')->where('quarter_delivery',$quarterUser->quarter_name)->get();
3838

3939

4040
return response()->json(OrderResource::collection($orders));
@@ -46,7 +46,7 @@ private function getOrderOfQuarter($residence){
4646
->where('quarter_name', $quarterInresidence->quarter_name)
4747
->first();
4848
$ordArray=[];
49-
$orders=Order::with('user')->where('fee_of_shipping',"!=",0)->where('status',"!=","2")->orderBy('created_at','desc')->get();
49+
$orders=Order::with('user')->where('fee_of_shipping',"!=",0)->where('status',"!=","2")->where('isTake',"!=",1)->orderBy('created_at','desc')->get();
5050
foreach($orders as $order){
5151
if($order->quarter_delivery){
5252
$quarter=Quarter::where('quarter_name',$order->quarter_delivery)->first();

app/Http/Controllers/Delivery/GetPreferenceOrderController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function getPreferenceOrders()
2020

2121
$QuarterNameArray[]=$vehicle->quarter_name;
2222
}
23-
$orders=Order::whereIn('quarter_delivery',$QuarterNameArray)->where('fee_of_shipping',"!=",0)->orderBy('created_at','desc')->get();
23+
$orders=Order::whereIn('quarter_delivery',$QuarterNameArray)->where('fee_of_shipping',"!=",0)->where('isTake',"!=",1)->orderBy('created_at','desc')->get();
2424
return response()->json(OrderResource::collection($orders));
2525

2626

0 commit comments

Comments
 (0)