Skip to content

Commit 67fc59b

Browse files
committed
Fix some issues
1 parent 6d2cd01 commit 67fc59b

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

app/Http/Controllers/OrderController.php

+15-1
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,13 @@ public function rejectOrder(Request $request, Order $order, Product $product)
162162
return redirect("/order/order_data");
163163
}
164164

165+
if ($order->status_id == 4) {
166+
$message = "Order status is already succeded by admin";
167+
168+
myFlasherBuilder(message: $message, failed: true);
169+
return redirect("/order/order_data");
170+
}
171+
165172
if ($order->status_id == 5) {
166173
$message = "Order status is already canceled by user";
167174

@@ -276,6 +283,13 @@ public function approveOrder(Order $order, Product $product)
276283

277284
public function endOrder(Order $order, Product $product)
278285
{
286+
if ($order->status->order_status == "done") {
287+
$message = "The order has already succeded by admin!";
288+
myFlasherBuilder(message: $message, failed: true);
289+
290+
return redirect("/order/order_data");
291+
}
292+
279293
if ($order->status->order_status != "approve") {
280294
$message = "Order has not been approved by the admin!";
281295
myFlasherBuilder(message: $message, failed: true);
@@ -286,7 +300,7 @@ public function endOrder(Order $order, Product $product)
286300
// change order status
287301
$updated_data = [
288302
"status_id" => 4,
289-
"note_id" => $order->payment->payment_method == "COD" ? 1 : 4,
303+
"note_id" => 5,
290304
"is_done" => 1,
291305
"refusal_reason" => null,
292306
];
-4.7 KB
Loading

0 commit comments

Comments
 (0)