pushCriteria(app(RequestCriteria::class)); } public function getAttentionsMe($uid, $settr) { if ($settr) { $res= $this->model->with(['resumes','companys'])->whereHas('resumes', function ($query) use ($uid) { $query->whereIn('id', $uid); })->whereHas('companys')->where($settr)->orderBy('id', 'desc')->paginate(5); } else { $res= $this->model->with(['resumes','companys'])->whereHas('resumes', function ($query) use ($uid) { $query->whereIn('id', $uid); })->whereHas('companys')->orderBy('id', 'desc')->paginate(5); } return $res; } public function delAttention($id) { return $this->model->whereIn('id', $id)->delete(); } public function getAttentionByResume($resume_id) { return $this->model->where('resume_id', $resume_id)->count(); } /** * 企业收藏的简历 * @param $where * @param $page * @return mixed */ public function favorityList($where, $map, $id, $page) { return $this->model->when($map, function ($query) use ($map) { $query->whereHas('resumes', function ($querys) use ($map) { $querys->where($map); }); })->where($where)->where('company_id', $id)->orderBy('created_at', 'desc')->paginate($page, ['*']); // return $this->model->with(['resumes'=>function ($query) use ($map) { // $query->where($map); // }])->where($where)->whereHas('resumes')->where('company_id', $id)->orderBy('created_at', 'desc')->paginate($page, ['*']); } /**删除企业收藏的简历 * @param $ids * @return mixed * @param $company_id */ public function favoritesResumeDel($ids,$company_id) { return $this->model->whereIn('id', $ids)->where("company_id",$company_id)->delete(); } public function findFavorite($resume_id, $company_id) { $where['resume_id'] = $resume_id; $where['company_id'] = $company_id; return $this->model->where($where)->first(); } public function cancelFavor($where) { return $this->model->where($where)->delete(); } public function getFavoritesResumes($where) { return $this->model->where($where)->get(); } public function insertData($data) { return $this->model->insert($data); } }