add: incluir campo de código de barras en la creación y actualización de productos

This commit is contained in:
Juan Felipe Zapata Moreno 2026-01-06 09:07:45 -06:00
parent 388ba3eff2
commit 06425157b8

View File

@ -12,6 +12,7 @@ public function createProduct(array $data)
$inventory = Inventory::create([ $inventory = Inventory::create([
'name' => $data['name'], 'name' => $data['name'],
'sku' => $data['sku'], 'sku' => $data['sku'],
'barcode' => $data['barcode'] ?? null,
'category_id' => $data['category_id'], 'category_id' => $data['category_id'],
'stock' => $data['stock'] ?? 0, 'stock' => $data['stock'] ?? 0,
]); ]);
@ -34,6 +35,7 @@ public function updateProduct(Inventory $inventory, array $data)
$inventoryData = array_filter([ $inventoryData = array_filter([
'name' => $data['name'] ?? null, 'name' => $data['name'] ?? null,
'sku' => $data['sku'] ?? null, 'sku' => $data['sku'] ?? null,
'barcode' => $data['barcode'] ?? null,
'category_id' => $data['category_id'] ?? null, 'category_id' => $data['category_id'] ?? null,
'stock' => $data['stock'] ?? null, 'stock' => $data['stock'] ?? null,
], fn($value) => $value !== null); ], fn($value) => $value !== null);