fields->parse($data); $this->transactions->run(function () use ($itemId, $data, $fields): void { $item = $this->items->findById($itemId) ?? throw new StockItemNotFound; $this->fields->check($data, $fields['name'], $itemId); $item->change($data->groupId, $fields['name'], $fields['unit'], $data->code, $data->supplier, $fields['reorderLevelMilli']); $this->items->save($item); }); } }