fix(product): 設定 is_active 欄位預設為 true 並更新現有資料為啟用

This commit is contained in:
2026-02-05 16:18:03 +08:00
parent 24aed44cd3
commit 397a8a6484
3 changed files with 45 additions and 8 deletions

View File

@@ -196,10 +196,6 @@ class ProductController extends Controller
$validated['code'] = $this->generateRandomCode();
}
if (!isset($validated['is_active'])) {
$validated['is_active'] = true;
}
$product = Product::create($validated);
return redirect()->route('products.index')->with('success', '商品已建立');
@@ -263,10 +259,6 @@ class ProductController extends Controller
$validated['code'] = $this->generateRandomCode();
}
if (!isset($validated['is_active'])) {
$validated['is_active'] = true;
}
$product->update($validated);
if ($request->input('from') === 'show') {