Where Clauses: Parameter Grouping

DB::table('users')
            ->where('name', '=', 'John')
            ->where(function ($query) {
                $query->where('votes', '>', 100)
                      ->orWhere('title', '=', 'Admin');
            })
            ->get();
Select * from users where name = 'John' and (votes > 100 or title = 'Admin')

Where Clauses: Parameter Grouping — Structure map

Clickable & Draggable!

Where Clauses: Parameter Grouping — Related pages: