I have this linkUser Table
id | User Id | LinkedUser ID
1 4 6
2 6 4
3 1 6
4 6 1
5 1 2
6 6 3
7 3 6
and then there is user table
id | name
1 user 1
2 user 2
3 user 3
..
..
I want to get all user detail where current user id is linked to other user id. Like if current logged in user id is 6
then it should return data 4,1,3
data from user table
I’m trying like this
DB::table('linked')->where('user_id', $loggedUserId)->get();
2
Answers
This should return all the user details where current logged-in user id is linked to other user id :