purchase_order = $purchase_order; } public function run() { $line_items = $this->purchase_order->line_items; foreach($line_items as $item) { $p = Product::where('product_key', $item->product_key)->where('company_id', $this->purchase_order->company_id)->first(); if(!$p) continue; $p->in_stock_quantity += $item->quantity; $p->saveQuietly(); } return $this->purchase_order; } }