【发布时间】:2021-05-22 16:13:57
【问题描述】:
我创建了一个非常简单的查询,但是 laravel 构建器添加了额外的查询,我想删除它。
\DB::enableQueryLog();
App\Proj::whereNotNull('deleted_at')->paginate(20);
dd(\DB::getQueryLog());
从中得出的查询如下:
select * from `projs` where `deleted_at` is not null and `projs`.`deleted_at` is null
要获得好的结果,需要的查询是:
select * from `projs` where `deleted_at` is not null
查询结果语句中没有'and ...'。
【问题讨论】: