Open kirkdm opened 7 years ago
When I try to do this i get this error
public function getCategories() {
$tree = []; $tree = Category::defaultOrder()->get()->toHeirarchy(); return response()->json($tree, 200, ['Content-Length' => strlen(json_encode($tree))]);
}
to work around this i have to do this
foreach (Category::roots()->orderBy('lft', 'asc')->get() as $root) { $tree[] = $root->getDescendantsAndSelf()->toHierarchy(); }
When I try to do this i get this error
public function getCategories() {
}
to work around this i have to do this
foreach (Category::roots()->orderBy('lft', 'asc')->get() as $root) { $tree[] = $root->getDescendantsAndSelf()->toHierarchy(); }