combinationGoodsUpdate = false; $this->businessGoods = $item->toArray(); $this->num = $num; $this->updateStock(); } private function updateStock() { try { $this->goodsSku = GoodsSku::query() ->where('external_sku_id', $this->businessGoods['external_sku_id']) ->first(); } catch (\Exception $e) { Log::error('事件库存更新失败: ' . $e->getMessage()); return false; } if ($this->goodsSku) { $this->goodsSku->stock += $this->num; $this->goodsSku->save(); } } /** * Get the channels the event should broadcast on. * * @return \Illuminate\Broadcasting\Channel|array */ public function broadcastOn() { return new PrivateChannel('channel-name'); } }