I am trying to select some data from two tables, here is sql code
`SELECT users.name FROM users, friends WHERE super_admin= false and friends.friend_id=users.id and friends.user_id = 4 and friends.status= 1`
I used sql to eloquent converter and it returns
`DB::table("users, friends")
->select("users.name")
->where("super_admin", "=", false)
->where("friends.friend_id", "=", users.id)
->where("friends.user_id", "=", 4)
->where("friends.status", "=", 1)
->get();`
but the problem is on the first line it seems that its impossible to write DB::table("users, friends") it was probably possible in some old versions of laravel.
2
Answers
You can use DB::raw:
Use Join statement to join the 2 tables