option attribute in layred navigation & category changes

This commit is contained in:
rahul shukla 2019-04-26 19:06:18 +05:30
parent 2674fbb9ca
commit 8d64ba656a
2 changed files with 7 additions and 7 deletions

View File

@ -156,7 +156,7 @@ class AttributeRepository extends Repository
*/
public function getFilterAttributes()
{
return $this->model->where('is_filterable', 1)->get();
return $this->model->where('is_filterable', 1)->with('options')->get();
}
/**

View File

@ -76,8 +76,8 @@ class CategoryRepository extends Repository
public function getCategoryTree($id = null)
{
return $id
? Category::orderBy('position', 'ASC')->where('id', '!=', $id)->get()->toTree()
: Category::orderBy('position', 'ASC')->get()->toTree();
? $this->model::orderBy('position', 'ASC')->where('id', '!=', $id)->get()->toTree()
: $this->model::orderBy('position', 'ASC')->get()->toTree();
}
@ -88,7 +88,7 @@ class CategoryRepository extends Repository
*/
public function getRootCategories()
{
return Category::withDepth()->having('depth', '=', 0)->get();
return $this->model::withDepth()->having('depth', '=', 0)->get();
}
/**
@ -104,9 +104,9 @@ class CategoryRepository extends Repository
if(array_key_exists($id, $categories))
return $categories[$id];
return $categories[$id] = $id
? Category::orderBy('position', 'ASC')->where('status', 1)->descendantsOf($id)->toTree()
: Category::orderBy('position', 'ASC')->where('status', 1)->get()->toTree();
return $categories[$id] = $id
? $this->model::orderBy('position', 'ASC')->where('status', 1)->descendantsOf($id)->toTree()
: $this->model::orderBy('position', 'ASC')->where('status', 1)->get()->toTree();
}
/**