DB::table('users') ->whereExists(function ($query) { $query->select(DB::raw(1)) ->from('orders') ->whereRaw('orders.user_id = users.id'); }) ->get();
Select * from users where exists ( select 1 from orders where orders.user_id = users.id )
Clickable & Draggable!