1use Illuminate\Support\Facades\DB;
2
3$users = DB::table('users')
4 ->join('contacts', 'users.id', '=', 'contacts.user_id')
5 ->join('orders', 'users.id', '=', 'orders.user_id')
6 ->select('users.*', 'contacts.phone', 'orders.price')
7 ->get();
1//Left join
2$users = DB::table('users')
3 ->leftJoin('posts', 'users.id', '=', 'posts.user_id')
4 ->get();
5//Right join
6$users = DB::table('users')
7 ->rightJoin('posts', 'users.id', '=', 'posts.user_id')
8 ->get();