feat: Implement nested product category display in admin datatable with expandable rows.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user