public function store(Request $request) { // ... // iterate (loop) over each item in the order items collection $order->items->each(function ($item) { // deduct the quantity of the item for this order // from the stock of the product and update the new stock $item->update(['stock' => ($item->stock - $item->pivot->quantity)]); }); // ... }