Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Laravel 使用模型的雄辩子查询_Laravel_Eloquent - Fatal编程技术网

Laravel 使用模型的雄辩子查询

Laravel 使用模型的雄辩子查询,laravel,eloquent,Laravel,Eloquent,我想把这个原始sql转换成雄辩的sql SELECT x.* from (SELECT * from clients where office_id IN(74,129,19)) AS x where x.firstname like '%parker%' or x.lastname like '%parker%' 我的模型是客户端好的,我用 use Illuminate\Database\Eloquent\Builder; $office_ids = [74,129,19]; C

我想把这个原始sql转换成雄辩的sql

SELECT x.* from 
(SELECT * from clients where office_id IN(74,129,19)) AS x 
where 
x.firstname like '%parker%' or 
x.lastname like '%parker%'


我的模型是
客户端
好的,我用

use Illuminate\Database\Eloquent\Builder;
$office_ids = [74,129,19];
Client::with('office')->whereIn('office_id',$office_ids)->where(function(Builder $dbQuery){

....

})