feat: Implement nested product category display in admin datatable with expandable rows.

This commit is contained in:
pbao9
2026-02-11 17:30:20 +07:00
parent 556b2c02e6
commit 99b61bfb51
5 changed files with 108 additions and 15 deletions
@@ -91,14 +91,17 @@ class ProductCategoryController extends Controller
public function datatable(Request $request)
{
$query = $this->productCategoryRepository->filter(
$request->all(),
[],
array_merge($request->all(), ['parent_id' => null]),
['children'],
[],
['*'],
true
);
return DataTables::eloquent($query)
->addColumn('details_control', function ($d) {
return view('administrator.pages.product.categories.datatable.details_control', ['row' => $d])->render();
})
->addColumn(
'action',
function ($d) use ($request) {
@@ -120,7 +123,7 @@ class ProductCategoryController extends Controller
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'])
->rawColumns(['details_control', 'action', 'is_active', 'checkbox'])
->make(true);
}
}