How to bidirectional search belongsToMany


#1

For example: if I have user id 1 then result is 3,5.

image


#2

Make a model/table class for the table Friends with with 2 belongs to relationships to the Users table. Query Friends with an or statement.


#3

yes have two relations lefFriends ,rightFriends in Friends table


#4

I found a solution after query. But is it possible with single query.