请看以下查询:
$testQuery = Customer::where('company_id', auth()->user()->company_id);
$testQuery
->where('name', 'like', '%test%')
->orWhere('age', '>', 22);
dd($testQuery->toSql());
这会产生以下SQL查询语句:
```
select * from customers where (company_id = ? and name like ? or age > ?) and customers.deleted_at is null
```
我需要的是这样的东西:
```
select * from customers where company_id = ? and (name like ? or age > ?) and customers.deleted_at is null
```
我要如何实现这一点? 即 company_id = ? 的第一个条件比对name和age的过滤器更重要?
现在,基于查询构建器构建查询的方式,我看到的结果来自于我在查询中指定的公司之外的公司。