Browse Source

Update SearchController

Daniel Supernault 6 years ago
parent
commit
3193f558cf
1 changed files with 1 additions and 1 deletions
  1. 1 1
      app/Http/Controllers/SearchController.php

+ 1 - 1
app/Http/Controllers/SearchController.php

@@ -54,7 +54,7 @@ class SearchController extends Controller
                 }
 
             }
-            $hashtags = Hashtag::select('id', 'name', 'slug')->where('slug', 'like', '%'.$tag.'%')->limit(20)->get();
+            $hashtags = Hashtag::select('id', 'name', 'slug')->where('slug', 'like', '%'.$tag.'%')->whereHas('posts')->limit(20)->get();
             if($hashtags->count() > 0) {
                 $tags = $hashtags->map(function ($item, $key) {
                     return [