How do I query three tables to send the info to the view
I am trying to do an activity function where users can monitor what their friends have been doing in terms of likes and comments on the app. I have managed to get the like activity this is how I have done it
public function activity()
{
$friends = Friendship::where('follower_id', Auth::id())->pluck('following_id');
$like_activity = Like::whereIn('likes.user_id', $friends)->get();
return view('friends.activity', compact('like_activity'));
}
However I am stuck on passing the comment activity of the connected user's friends. I have 2 tables (likes and comments). I want to do a join to get them both and pass it to the view in one go.