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();
1use Illuminate\Support\Facades\DB;
2
3$first = DB::table('users')
4 ->whereNull('first_name');
5
6$users = DB::table('users')
7 ->whereNull('last_name')
8 ->union($first)
9 ->get();