|
@@ -32,9 +32,14 @@ class PageService extends BaseService
|
|
|
})->values();
|
|
|
}
|
|
|
|
|
|
- public function categoryTree()
|
|
|
+ public function categoryTree($source = "")
|
|
|
{
|
|
|
- $categoryS = Category::with("childS")->where("parent_id", 0)->where("index_weight", ">", 0)->orderByDesc("category_weight")->get(["id", "name", "thumb", "parent_id", "level", "weight"]);
|
|
|
+ if ($source == "home") {
|
|
|
+ $categoryS = Category::with("childS")->where("parent_id", 0)->where("index_weight", ">", 0)->orderByDesc("category_weight")->get(["id", "name", "thumb", "parent_id", "level", "weight"]);
|
|
|
+ } else {
|
|
|
+ $categoryS = Category::with("childS")->where("parent_id", 0)->where("index_weight", ">", 0)->orderByDesc("index_weight")->get(["id", "name", "thumb", "parent_id", "level", "weight"]);
|
|
|
+ }
|
|
|
+
|
|
|
return $categoryS->map(function (Category $category) {
|
|
|
return [
|
|
|
"id" => $category->id,
|