diff --git a/app/Modules/Inventory/Controllers/ProductController.php b/app/Modules/Inventory/Controllers/ProductController.php index 8d0abba..2bdca4e 100644 --- a/app/Modules/Inventory/Controllers/ProductController.php +++ b/app/Modules/Inventory/Controllers/ProductController.php @@ -188,9 +188,10 @@ class ProductController extends Controller 'price' => 'nullable|numeric|min:0', 'member_price' => 'nullable|numeric|min:0', 'wholesale_price' => 'nullable|numeric|min:0', - 'is_active' => 'boolean', ]); + $validated['is_active'] = true; + if (empty($validated['code'])) { $validated['code'] = $this->generateRandomCode(); } @@ -250,9 +251,10 @@ class ProductController extends Controller 'price' => 'nullable|numeric|min:0', 'member_price' => 'nullable|numeric|min:0', 'wholesale_price' => 'nullable|numeric|min:0', - 'is_active' => 'boolean', ]); + $validated['is_active'] = true; + if (empty($validated['code'])) { $validated['code'] = $this->generateRandomCode(); }