-
Notifications
You must be signed in to change notification settings - Fork 2
JoinClause
Viames Marino edited this page Feb 23, 2026
·
1 revision
Pair\Orm\JoinClause builds complex JOIN ... ON ... conditions for Query.
$join = new \Pair\Orm\JoinClause('left', 'users u');on(string $first, string $operator, string $second, string $boolean = 'and')orOn(string $first, string $operator, string $second)
where(string $column, mixed $operator = null, mixed $value = null, string $boolean = 'and')orWhere(...)whereIn(string $column, array $values, string $boolean = 'and', bool $not = false)-
whereNotIn(...),orWhereIn(...),orWhereNotIn(...) whereNull(string $column, string $boolean = 'and', bool $not = false)-
whereNotNull(...),orWhereNull(...),orWhereNotNull(...) whereRaw(string $sql, array $bindings = [], string $boolean = 'and')orWhereRaw(...)
getClauses(): arraygetBindings(): array
use Pair\Orm\Query;
$rows = Query::table('orders o')
->leftJoin('users u', function ($join) {
$join->on('u.id', '=', 'o.user_id')
->where('u.active', 1)
->whereNotNull('u.email')
->orWhereIn('u.role', ['admin', 'manager']);
})
->select('o.id', 'u.email')
->get();This allows expressive join conditions without raw SQL for most cases.
See also: Query, QueryGrammar, Database.