This commit is contained in:
pbao9
2026-02-07 16:18:39 +07:00
parent e7b9ce7485
commit 3dc19ccb83
11 changed files with 222 additions and 38 deletions
@@ -59,6 +59,23 @@ class ProductCategoryController extends Controller
return redirect()->route('products.group.index')->with('success', 'Delete Group Success');
}
public function trash()
{
return view('administrator.pages.product.categories.trash');
}
public function restore(int $id)
{
$this->productCategoryService->restore($id);
return redirect()->route('products.group.trash')->with('success', 'Restore Group Success');
}
public function forceDelete(int $id)
{
$this->productCategoryService->forceDelete($id);
return redirect()->route('products.group.trash')->with('success', 'Force Delete Group Success');
}
public function datatable(Request $request)
{
$query = $this->productCategoryRepository->filter(
@@ -72,7 +89,10 @@ class ProductCategoryController extends Controller
return DataTables::eloquent($query)
->addColumn(
'action',
function ($d) {
function ($d) use ($request) {
if ($request->has('trashed') && $request->trashed == 1) {
return view('administrator.pages.product.categories.datatable.action_trash', ['row' => $d])->render();
}
return view('administrator.pages.product.categories.datatable.action', ['row' => $d])->render();
}
)
@@ -29,4 +29,14 @@ class ProductCategoryService implements ProductCategoryServiceInterface
{
return $this->repository->delete($id);
}
public function restore(int $id)
{
return $this->repository->restore($id);
}
public function forceDelete(int $id)
{
return $this->repository->forceDelete($id);
}
}
@@ -6,4 +6,8 @@ interface ProductCategoryServiceInterface {
public function store(array $data);
public function update(int $id, array $data);
public function delete(int $id);
public function restore(int $id);
public function forceDelete(int $id);
}