|
@@ -140,6 +140,7 @@ class PageService extends BaseService
|
|
|
$attrMap = json_decode($attrs, true);
|
|
|
}
|
|
|
}
|
|
|
+ $category = Category::find($id);
|
|
|
$p = Goods::where("status", Goods::STATUS_OK)->when($params['keyword'], function (Builder $query) use ($params) {
|
|
|
$query->where("name", "like", "%" . $params['keyword'] . "%");
|
|
|
})->when($attrMap, function (Builder $query) use ($attrMap) {
|
|
@@ -164,6 +165,12 @@ class PageService extends BaseService
|
|
|
"weight" => $model->weight,
|
|
|
];
|
|
|
}, $p->items()),
|
|
|
+ "category" => $category->childS->map(function (Category $model) {
|
|
|
+ return ["id" => $model->id,
|
|
|
+ "thumb" => $model->thumb,
|
|
|
+ "name" => $model->name,
|
|
|
+ ];
|
|
|
+ }),
|
|
|
];
|
|
|
|
|
|
}
|