Where Clauses: Where Exists Clauses

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
)

Where Clauses: Where Exists Clauses — Structure map

Clickable & Draggable!

Where Clauses: Where Exists Clauses — Related pages: