From 9511ebe71fbc581d88232fa4e0412448809398ec Mon Sep 17 00:00:00 2001 From: sky121113 Date: Mon, 15 Jun 2026 11:42:06 +0800 Subject: [PATCH] =?UTF-8?q?[FEAT]=20=E5=95=86=E5=93=81=E8=A9=B3=E6=83=85?= =?UTF-8?q?=E6=94=AF=E6=8F=B4=E5=A4=9A=E8=A1=8C=E6=8E=92=E7=89=88=E4=B8=A6?= =?UTF-8?q?=E5=8E=9F=E6=A8=A3=E4=B8=8B=E7=99=BC=20APP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 多語系輸入元件 product-locale-tabs 新增 multiline 參數,啟用時改用 textarea(保留換行、可垂直拖曳),名稱欄位維持單行 input。 2. 商品新增/編輯頁的「詳情」欄位改為多行輸入。 3. ProductController store/update 將 specs.* 與 spec 驗證上限由 255 放寬至 2000。 4. 新增 migration 將 products.spec 由 VARCHAR(255) 改為 TEXT,避免較長 zh_TW 詳情被截斷(translations.value 本即 TEXT)。 Co-Authored-By: Claude Opus 4.8 (1M context) --- .../Controllers/Admin/ProductController.php | 8 +++---- ...15_000000_change_products_spec_to_text.php | 22 +++++++++++++++++++ .../views/admin/products/create.blade.php | 2 +- resources/views/admin/products/edit.blade.php | 2 +- .../components/product-locale-tabs.blade.php | 20 ++++++++++++----- 5 files changed, 43 insertions(+), 11 deletions(-) create mode 100644 database/migrations/2026_06_15_000000_change_products_spec_to_text.php diff --git a/app/Http/Controllers/Admin/ProductController.php b/app/Http/Controllers/Admin/ProductController.php index 5dab676..e72eae8 100644 --- a/app/Http/Controllers/Admin/ProductController.php +++ b/app/Http/Controllers/Admin/ProductController.php @@ -272,9 +272,9 @@ class ProductController extends Controller 'names.zh_TW' => 'required|string|max:255', 'names.*' => 'nullable|string|max:255', 'specs' => 'nullable|array', - 'specs.*' => 'nullable|string|max:255', + 'specs.*' => 'nullable|string|max:2000', 'barcode' => 'nullable|string|max:100', - 'spec' => 'nullable|string|max:255', + 'spec' => 'nullable|string|max:2000', 'category_id' => 'nullable|exists:product_categories,id', 'manufacturer' => 'nullable|string|max:255', 'track_limit' => 'required|integer|min:1', @@ -374,9 +374,9 @@ class ProductController extends Controller 'names.zh_TW' => 'required|string|max:255', 'names.*' => 'nullable|string|max:255', 'specs' => 'nullable|array', - 'specs.*' => 'nullable|string|max:255', + 'specs.*' => 'nullable|string|max:2000', 'barcode' => 'nullable|string|max:100', - 'spec' => 'nullable|string|max:255', + 'spec' => 'nullable|string|max:2000', 'category_id' => 'nullable|exists:product_categories,id', 'manufacturer' => 'nullable|string|max:255', 'track_limit' => 'required|integer|min:1', diff --git a/database/migrations/2026_06_15_000000_change_products_spec_to_text.php b/database/migrations/2026_06_15_000000_change_products_spec_to_text.php new file mode 100644 index 0000000..e992e88 --- /dev/null +++ b/database/migrations/2026_06_15_000000_change_products_spec_to_text.php @@ -0,0 +1,22 @@ +

{{ __('Details (Multilingual)') }}

- + diff --git a/resources/views/admin/products/edit.blade.php b/resources/views/admin/products/edit.blade.php index d06d330..df6a9e6 100644 --- a/resources/views/admin/products/edit.blade.php +++ b/resources/views/admin/products/edit.blade.php @@ -165,7 +165,7 @@

{{ __('Details (Multilingual)') }}

- + diff --git a/resources/views/components/product-locale-tabs.blade.php b/resources/views/components/product-locale-tabs.blade.php index f1516bf..2fc5801 100644 --- a/resources/views/components/product-locale-tabs.blade.php +++ b/resources/views/components/product-locale-tabs.blade.php @@ -2,6 +2,7 @@ 'field', // 'names' | 'specs' — 對應 formData[field] 與送出欄位名稱 'active', // Alpine 狀態變數名稱,如 'activeNameLocale' 'required' => true, // zh_TW 是否必填(名稱必填、規格選填) + 'multiline' => false, // 是否使用多行 textarea(詳情啟用,名稱維持單行) ]) {{-- @@ -32,11 +33,20 @@ {{-- Inputs:所有語系皆在 DOM(一併送出),僅顯示當前 Tab --}}