baum icon indicating copy to clipboard operation
baum copied to clipboard

Call to undefined method Baum\Extensions\Query\Builder::defaultOrder()

Open kirkdm opened this issue 8 years ago • 0 comments

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(); }

kirkdm avatar Jan 02 '17 23:01 kirkdm