/** * Basing on tags, getting count of child tag * * @param array $tags (example: history, technology,...) * @param int $relationType * @return array * @access public */ public function addAdminData($tags, $relationType) { $tagModel = new tagModel(); $productService = new productService(); $tagsWithAdminData = array(); foreach ($tags as $tag) { $tagCache = '__count_search_product_by_tag_id__'; $tag->child_count = $tagModel->getChildCount($tag->child_id, $relationType); $tag->id = $tag->child_id . '_' . $tag->parent_id . '_' . $relationType; if (Cache::tags($tagCache)->get($tag->child_id)) { $tag->product_count = Cache::tags($tagCache)->get($tag->child_id); } else { $tag->product_count = '?'; } $tagsWithAdminData[] = $tag; } return $this->formatTags($tagsWithAdminData); }