Update DiscoverController

This commit is contained in:
Daniel Supernault 2018-11-18 21:26:52 -07:00
parent 4a7a56f2cb
commit a616bd66f6
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 5 additions and 1 deletions

View File

@ -36,13 +36,17 @@ class DiscoverController extends Controller
->firstOrFail();
$posts = $tag->posts()
->whereHas('media')
->withCount(['likes', 'comments'])
->whereIsNsfw(false)
->whereVisibility('public')
->has('media')
->orderBy('id', 'desc')
->simplePaginate(12);
if($posts->count() == 0) {
abort(404);
}
return view('discover.tags.show', compact('tag', 'posts'));
}
}