我的桌子:
Candidates :
id
first_name
last_name
email
password
jobs :
id
name
candidate_job :
id
region_id
candidate_id
我制作研究模块。当我捕捉到研究过的元素时:http: //i.stack.imgur.com/FrB7R.png
当公司(招聘人员)进行研究时,我希望研究模块,返回在注册时检查区域和工作的用户(候选人)
我的要求雄辩的 orm :
Candidate::with('regions')
->whereIn('candidate_region.region_id', $region)
->with('jobs')
->whereIn('candidate_job.job_id', $job)
->where('imavailable', '1')
->where('dateDisponible', '<=', $date)
->paginate(20);
它不起作用,返回的错误是:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'candidate_region.region_id' in 'where clause' (SQL: select count(*) as aggregate from `candidates` where `candidate_region`.`region_id` in (?, ?, ?) and `candidate_job`.`job_id` in (?, ?, ?) and `imavailable` = ? and `dateDisponible` <= ?) (Bindings: array ( 0 => '4', 1 => '8', 2 => '40', 3 => '2', 4 => '8', 5 => '42', 6 => '1', 7 => '2013-06-10', ))
我不明白,为什么?
怎么做 ?谢谢