|
|
@ -95,4 +95,29 @@ class CategoryService implements CategoryServiceInterface |
|
|
|
|
|
|
|
|
return array_values($returnData); |
|
|
return array_values($returnData); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function allForStoreIncludeOff($storeId) |
|
|
|
|
|
{ |
|
|
|
|
|
$goodsTypeIds = Goods::query() |
|
|
|
|
|
->withoutGlobalScope('normal') |
|
|
|
|
|
->where(['store_id' => $storeId]) |
|
|
|
|
|
->groupBy('category_id', 'id') |
|
|
|
|
|
->pluck('category_id'); |
|
|
|
|
|
|
|
|
|
|
|
$categories = Category::query() |
|
|
|
|
|
->with(['goodsCategory']) |
|
|
|
|
|
->whereIn('id', $goodsTypeIds) |
|
|
|
|
|
->orderBy('sort', 'DESC') |
|
|
|
|
|
->orderBy('id', 'DESC') |
|
|
|
|
|
->get()->toArray(); |
|
|
|
|
|
|
|
|
|
|
|
foreach ($categories as $key => &$item) { |
|
|
|
|
|
$item['goods_category_ids'] = ''; |
|
|
|
|
|
if (isset($item['goods_category']) && $item['goods_category']) { |
|
|
|
|
|
$item['goods_category_ids'] = implode(',', array_values(array_column($item['goods_category'], 'id'))); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $categories; |
|
|
|
|
|
} |
|
|
} |
|
|
} |