/**
  * Show all products by tag.
  *
  * @param $id
  * @return \Illuminate\View\View
  */
 public function tag($id)
 {
     $categories = Category::all();
     $tag = Tag::find($id);
     return view('store.tag', compact('categories', 'tag'));
 }
 private function storeTags($inputTags)
 {
     $tags = explode(',', $inputTags['tags']);
     $tags = array_map(function ($item) {
         return trim($item);
     }, $tags);
     $tags = array_filter($tags);
     $tagsIDs = array_map(function ($tagName) {
         return Tag::firstOrCreate(['name' => $tagName])->id;
     }, $tags);
     return $tagsIDs;
 }