fix: user posts

This commit is contained in:
Roardom
2023-04-12 03:42:40 +00:00
parent b70bbf8fa4
commit c4745f8f87
+5 -1
View File
@@ -23,7 +23,11 @@ class PostController extends Controller
*/
public function index(User $user): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
{
$posts = $user->posts()->with(['topic', 'user'])->latest()->paginate(25);
$posts = $user->posts()
->withCount(['likes', 'dislikes'])
->with(['topic', 'user'])
->latest()
->paginate(25);
return view('user.post.index', [
'posts' => $posts,