Explorar el Código

Update SearchController

Daniel Supernault hace 6 años
padre
commit
3193f558cf
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  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 [