commit
a8a28ccf60
|
|
@ -122,7 +122,7 @@ class CategoryController extends Controller
|
|||
{
|
||||
$category = $this->categoryRepository->findOrFail($id);
|
||||
|
||||
$categories = $this->categoryRepository->getCategoryTree($id);
|
||||
$categories = $this->categoryRepository->getCategoryTreeWithoutDescendant($id);
|
||||
|
||||
$attributes = $this->attributeRepository->findWhere(['is_filterable' => 1]);
|
||||
|
||||
|
|
|
|||
|
|
@ -76,6 +76,19 @@ class CategoryRepository extends Repository
|
|||
: $this->model::orderBy('position', 'ASC')->get()->toTree();
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify category tree
|
||||
*
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCategoryTreeWithoutDescendant($id = null)
|
||||
{
|
||||
return $id
|
||||
? $this->model::orderBy('position', 'ASC')->where('id', '!=', $id)->whereNotDescendantOf($id)->get()->toTree()
|
||||
: $this->model::orderBy('position', 'ASC')->get()->toTree();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get root categories
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue