This commit is contained in:
pbao9
2026-02-07 17:50:36 +07:00
parent 2a6a5d2131
commit e9f2218030
10 changed files with 601 additions and 245 deletions
@@ -76,6 +76,18 @@ class ProductCategoryController extends Controller
return redirect()->route('products.group.trash')->with('success', 'Force Delete Group Success');
}
public function bulkDelete(Request $request)
{
$request->validate([
'ids' => 'required|array',
'ids.*' => 'exists:product_categories,id'
]);
$this->productCategoryService->bulkDelete($request->ids);
return response()->json(['message' => 'Selected product groups deleted successfully.']);
}
public function datatable(Request $request)
{
$query = $this->productCategoryRepository->filter(
@@ -102,7 +114,13 @@ class ProductCategoryController extends Controller
return view('administrator.pages.product.categories.datatable.status', ['row' => $d])->render();
}
)
->rawColumns(['action', 'is_active'])
->addColumn(
'checkbox',
function ($d) {
return '<div class="form-check d-flex align-items-center justify-content-center"><input class="form-check-input dt-checkbox" type="checkbox" value="' . $d->id . '"></div>';
}
)
->rawColumns(['action', 'is_active', 'checkbox'])
->make(true);
}
}
@@ -39,4 +39,9 @@ class ProductCategoryService implements ProductCategoryServiceInterface
{
return $this->repository->forceDelete($id);
}
public function bulkDelete(array $ids)
{
return $this->repository->bulkDelete($ids);
}
}
@@ -10,4 +10,6 @@ interface ProductCategoryServiceInterface {
public function restore(int $id);
public function forceDelete(int $id);
public function bulkDelete(array $ids);
}