123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <?php
- /**
- * Created by PhpStorm.
- * User: ZhangHao
- * Date: 2019/6/17
- * Time: 15:13
- */
- namespace App\Repositories\Jobfairout;
- use App\Models\Jobfairout\JobfairoutPutJob;
- use Prettus\Repository\Eloquent\BaseRepository;
- class jobfairoutPutJobRepository extends BaseRepository
- {
- public function model()
- {
- return JobfairoutPutJob::class;
- }
- public function getJobfairJob($where)
- {
- return $this->model->with('jobs')->whereHas('jobs',function ($query){
- $query->where('audit',1);
- })->where($where)->get();
- }
- public function getJobsCount($jobfair_id, $comArr)
- {
- return $this->model->whereHas('jobs',function ($query) use ($comArr){
- $query->where('audit',1)->whereIn('company_id', $comArr);
- })->where(['jobfair_id'=>$jobfair_id])->count();
- }
- public function getNeedPerson($jobfair_id)
- {
- return $this->model->joinJobfairJob()
- ->where(['jobfair_jobs.audit'=>1,'jobfairout_put_jobs.jobfair_id' => $jobfair_id])
- ->whereHas('jobfair_company',function($query){
- $query->where('audit',1);
- })
- ->selectRaw('sum(jobfair_jobs.amount) as sum')
- ->first();
- }
- //招聘会参展职位
- public function jobfairCompanyJob($where,$map1, $limit)
- {
- return $this->model->with(['jobfair_company','jobfairs','jobs'])->whereHas('jobs',function ($query) use ($map1){
- $query->where($map1)->orderByRaw("Field(jobfair_jobs.audit,2,1,3)");
- })->where($where)->orderByDesc('created_at')->paginate($limit);
- }
- public function findDone($where)
- {
- return $this->model->where($where)->first();
- }
- public function searchJob($jobfair_id, $keyword, $company_id, $id)
- {
- return $this->model->whereHas('jobs',function ($query) use ($company_id,$keyword){
- $query->where('audit',1)->where('company_id',$company_id)->where(function ($query) use ($keyword){
- $query->where('jobs_name', 'like', '%'.$keyword.'%')->orWhere('company_name', 'like', '%'.$keyword.'%');
- });
- })->where(['jobfair_id'=> $jobfair_id])->where('exid', $id)->get();
- }
- public function getOne($where)
- {
- return $this->model->with(['jobfairs','jobs'])->where($where)->first();
- }
- public function getJobIds($where)
- {
- return $this->model->whereHas('jobs',function ($query){
- $query->where('audit',1);
- })->where($where)->pluck('job_id')->toArray();
- }
- public function destroyArr($del_array)
- {
- return $this->model->destroy($del_array);
- }
- public function delList($where,$ids)
- {
- return $this->model->where($where)->whereIn('job_id',$ids)->delete();
- }
- //允许预定的招聘会
- public function getJobfairOpen()
- {
- return $this->model->where('predetermined_status', 1)->get();
- }
- public function getWhere($jobs_where,$put_jobs_where)
- {
- return $this->model->whereHas('jobs',function ($query) use($jobs_where){
- $query->where($jobs_where);
- })->where($put_jobs_where)->groupBy('job_id')->get();
- }
- public function delJobs($id)
- {
- return $this->model->whereIn('id', $id)->delete();
- }
- public function getPluck($where,$column)
- {
- return $this->model->where($where)->pluck($column);
- }
- }
|