laravel雄辯框架的一點麻煩。WhereNotExists Laravel Eloquent
我需要複製這樣的查詢:
SELECT *
FROM RepairJob
WHERE NOT EXISTS (SELECT repair_job_id
FROM DismissedRequest
WHERE RepairJob.id = DismissedRequest.repair_job_id);
現在我有
$repairJobs = RepairJob::with('repairJobPhoto', 'city', 'vehicle')->where('active', '=', 'Y')->whereNotExists('id', [DismissedRequest::all('repair_job_id')])->get();
任何人的想法?我需要把所有的repairjobs那裏沒有記錄在駁回申請表
我使用上述
Argument 1 passed to Illuminate\Database\Query\Builder::whereNotExists() must be an instance of Closure, string given
'whereNotExists'接受函數並改變'$ query'。請參閱此處'whereExists'的文檔:https://laravel.com/docs/5.0/queries#advanced-wheres – swatkins
這不是雄辯嗎? – Sytham