/**
  * @param $cat
  * @return array
  */
 private function getTagList($cat)
 {
     $tags = Tag::whereHas('categories', function ($q) use($cat) {
         $q->whereIn('category_id', $cat);
     })->get(['id'])->toArray();
     $tags = array_flatten($tags);
     return $tags;
 }