This isn't an Eloquent behavior. Try to build your SQL query directly on database
I see your point. Make this change: $query->where('friend_id', '=', $id)->where('user_id', '='...
Have you ever tried this? $friend = User::whereHas('friends', function($query) use ($id, $user) {...
As far as I understood you want to bring all posts from a certain category, right? So try this: $pos...
The Laravel portal for problem solving, knowledge sharing and community building.