diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index a9d9846c5..6777dbb49 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -32,7 +32,12 @@ class ProfileController extends Controller // TODO: refactor this mess $owner = Auth::check() && Auth::id() === $user->user_id; $following = ($owner == false && Auth::check()) ? $user->followedBy(Auth::user()->profile) : false; - $timeline = $user->statuses()->whereHas('media')->whereNull('in_reply_to_id')->orderBy('id','desc')->paginate(21); + $timeline = $user->statuses() + ->whereHas('media') + ->whereNull('in_reply_to_id') + ->orderBy('id','desc') + ->withCount(['comments', 'likes']) + ->simplePaginate(21); return view('profile.show', compact('user', 'owner', 'following', 'timeline')); } diff --git a/resources/views/profile/show.blade.php b/resources/views/profile/show.blade.php index ca7166401..c2206387a 100644 --- a/resources/views/profile/show.blade.php +++ b/resources/views/profile/show.blade.php @@ -106,10 +106,10 @@
- {{$status->likes()->count()}} + {{$status->likes_count}} - {{$status->comments()->count()}} + {{$status->comments_count}}