Prechádzať zdrojové kódy

fix error on add order 2

Alexander Musikhin 8 mesiacov pred
rodič
commit
d750f8a869
1 zmenil súbory, kde vykonal 2 pridanie a 3 odobranie
  1. 2 3
      app/Http/Controllers/OrderController.php

+ 2 - 3
app/Http/Controllers/OrderController.php

@@ -174,12 +174,11 @@ class OrderController extends Controller
         unset($data['products']);
 
         if(isset($data['id'])) {
-            Order::query()->where('id', $data['id'])->update($data);
+            $order = Order::query()->where('id', $data['id'])->update($data);
         } else {
-            Order::query()->create($data);
+            $order = Order::query()->create($data);
         }
         if($products) {
-            $order = Order::query()->where('id', $data['id'])->first();
             $order->products()->sync($products);
         }