[STYLE] 標準化商品管理與廣告彈窗 UI,完善商品分類多語系 CRUD 功能
All checks were successful
star-cloud-deploy-demo / deploy-demo (push) Successful in 1m2s

This commit is contained in:
2026-04-01 08:38:03 +08:00
parent 759fae4380
commit e27eee78f5
12 changed files with 764 additions and 283 deletions

View File

@@ -19,7 +19,7 @@ class ProductController extends Controller
public function index(Request $request)
{
$user = auth()->user();
$query = Product::with(['category', 'translations', 'company']);
$query = Product::with(['category.translations', 'translations', 'company']);
// 搜尋
if ($request->filled('search')) {
@@ -47,7 +47,7 @@ class ProductController extends Controller
}
$products = $query->latest()->paginate($per_page)->withQueryString();
$categories = ProductCategory::all();
$categories = ProductCategory::with('translations')->get();
$companies = $user->isSystemAdmin() ? Company::all() : collect();
// 系統管理員在過濾特定公司時,應顯示該公司的功能開關 (如物料代碼、點數規則)
@@ -68,7 +68,7 @@ class ProductController extends Controller
public function create(Request $request)
{
$user = auth()->user();
$categories = ProductCategory::all();
$categories = ProductCategory::with('translations')->get();
$companies = $user->isSystemAdmin() ? Company::all() : collect();
// If system admin, check if company_id is provided in URL to get settings
@@ -94,7 +94,7 @@ class ProductController extends Controller
->where('key', $product->name_dictionary_key)
->get()
);
$categories = ProductCategory::all();
$categories = ProductCategory::with('translations')->get();
$companies = $user->isSystemAdmin() ? Company::all() : collect();
// Use the product's company settings for editing