[FEAT] 移除「商品狀態」冗餘模組、優化麵包屑導航與完善帳號角色過濾邏輯
All checks were successful
star-cloud-deploy-demo / deploy-demo (push) Successful in 46s
All checks were successful
star-cloud-deploy-demo / deploy-demo (push) Successful in 46s
This commit is contained in:
@@ -297,6 +297,20 @@ class ProductController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function toggleStatus($id)
|
||||
{
|
||||
try {
|
||||
$product = Product::findOrFail($id);
|
||||
$product->is_active = !$product->is_active;
|
||||
$product->save();
|
||||
|
||||
$status = $product->is_active ? __('Enabled') : __('Disabled');
|
||||
return redirect()->back()->with('success', __('Product status updated to :status', ['status' => $status]));
|
||||
} catch (\Exception $e) {
|
||||
return redirect()->back()->with('error', $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user