lifetime; } public function getKey($id = null) { return 'category_tree'; } public function getContent($id = null) { $categories = CategoryModel::query() ->where('published = 1 AND deleted = 0') ->execute(); if ($categories->count() == 0) { return []; } return $this->handleContent($categories); } /** * @param \App\Models\Category[] $categories * @return array */ protected function handleContent($categories) { $items = $categories->toArray(); $builder = new CategoryTreeListBuilder(); $content = $builder->handleTreeList($items); return $content; } }