123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- <?php
- /**
- * Created by PhpStorm.
- * User: wuzhenke
- * Date: 2019/1/25
- * Time: 17:54
- */
- namespace App\Repositories\Jobfairout;
- use App\Models\Jobfairout\JobfairoutPersonalJobsApply;
- use Prettus\Repository\Eloquent\BaseRepository;
- class JobfairoutPersonalJobsApplyRepository extends BaseRepository
- {
- public function model()
- {
- return JobfairoutPersonalJobsApply::class;
- }
- public function getResume($com_id,$where=[])
- {
- return $this->model->whereHas('jobfairs')
- ->whereHas('resumes')
- ->whereHas('putJobs')
- ->where(['company_id'=>$com_id])
- ->where($where)
- ->orderBy("updated_at", 'desc')
- ->paginate(10);
- }
- public function downResumeDel($ids)
- {
- return $this->model->whereIn('id', $ids)->delete();
- }
- public function personJobfair($data, $where, $resumeWhere)
- {
- return $this->model->with(['resumes', 'putJobs'=>function ($query) use ($where) {
- $query->with(['jobs'=>function ($query) use ($where){
- $query->whereIn('audit', $where)->where('display', 1);
- }]);
- }, 'jobfairs'])->where($data)->whereHas('resumes')->whereHas('putJobs')->whereHas('jobfairs')->orderBy('id', 'desc')->paginate(10);
- }
- public function applyJobs($where,$limit = '')
- {
- if($limit){
- return $this->model->with(['jobfairs','resumes','putJobs'])->whereHas('resumes')->where($where)->paginate($limit);
- }else{
- return $this->model->with(['jobfairs','resumes','putJobs'])->whereHas('resumes')->where($where)->get();
- }
- }
- public function padApplyJobs($where)
- {
- return $this->model->has('resumes')->has('putJobs')
- ->where($where)->where(function ($query) {
- $query->where(['is_apply'=>1,'is_interview'=>1])
- ->orWhere(['is_apply'=>2]);
- })->paginate(10);
- }
- public function interviewAdd($data)
- {
- return $this->model->create($data);
- }
- public function interviewEdit($id)
- {
- $interview=$this->model->find($id);
- $interview->is_interview=1;
- return $interview->save();
- }
- /*
- * 判断是否已投递
- */
- public function applyFind($where){
- return $res = $this->model->where($where)->first();
- }
- /*
- * 判断是否已邀请
- */
- public function interviewFind($where){
- $res = $this->model->where($where)
- ->where(function ($query) {
- $query->where(['is_apply'=>1,'is_interview'=>1])
- ->orWhere(['is_apply'=>2])->first();
- })->first();
- return $res ? true : false;
- }
- //删除
- public function delete($where){
- return $this->model->where($where)->delete();
- }
- //获取个人所投简历
- public function getPersonApply($where,$limit,$page){
- return $this->model->with(['putJobs'=>function($query){
- $query->with('jobs');
- }])->where($where)->paginate($limit,['*'],'page',$page);
- }
- public function applyJobsPage($where,$limit,$page)
- {
- return $this->model
- ->with(['jobfairs','resumes','putJobs'])
- ->where($where)->where(function ($query) {
- $query->where(['is_apply'=>1,'is_interview'=>1])
- ->orWhere(['is_apply'=>2]);
- })->paginate($limit,['*'],'page',$page);
- }
- public function getJobsApply($where)
- {
- return $this->model->where($where)->orderBy('id', 'desc')->get();
- }
- public function getResumeJobs($com_id,$where,$where1){
- return $this->model
- ->whereHas('jobfairs')
- ->whereHas('resumes')
- ->whereHas('putJobs',function($query) use ($where1){
- $query->whereHas('jobs',function($query) use ($where1){
- $query->where($where1);
- });
- })
- ->where(['company_id'=>$com_id])
- ->where($where)
- ->orderBy("updated_at", 'desc')
- ->paginate(10);
- }
- public function getPluck($where,$colunm)
- {
- return $this->model->where($where)->pluck($colunm);
- }
- }
|