JobfairoutPersonalJobsApplyRepository.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: wuzhenke
  5. * Date: 2019/1/25
  6. * Time: 17:54
  7. */
  8. namespace App\Repositories\Jobfairout;
  9. use App\Models\Jobfairout\JobfairoutPersonalJobsApply;
  10. use Prettus\Repository\Eloquent\BaseRepository;
  11. class JobfairoutPersonalJobsApplyRepository extends BaseRepository
  12. {
  13. public function model()
  14. {
  15. return JobfairoutPersonalJobsApply::class;
  16. }
  17. public function getResume($com_id,$where=[])
  18. {
  19. return $this->model->whereHas('jobfairs')
  20. ->whereHas('resumes')
  21. ->whereHas('putJobs')
  22. ->where(['company_id'=>$com_id])
  23. ->where($where)
  24. ->orderBy("updated_at", 'desc')
  25. ->paginate(10);
  26. }
  27. public function downResumeDel($ids)
  28. {
  29. return $this->model->whereIn('id', $ids)->delete();
  30. }
  31. public function personJobfair($data, $where, $resumeWhere)
  32. {
  33. return $this->model->with(['resumes', 'putJobs'=>function ($query) use ($where) {
  34. $query->with(['jobs'=>function ($query) use ($where){
  35. $query->whereIn('audit', $where)->where('display', 1);
  36. }]);
  37. }, 'jobfairs'])->where($data)->whereHas('resumes')->whereHas('putJobs')->whereHas('jobfairs')->orderBy('id', 'desc')->paginate(10);
  38. }
  39. public function applyJobs($where,$limit = '')
  40. {
  41. if($limit){
  42. return $this->model->with(['jobfairs','resumes','putJobs'])->whereHas('resumes')->where($where)->paginate($limit);
  43. }else{
  44. return $this->model->with(['jobfairs','resumes','putJobs'])->whereHas('resumes')->where($where)->get();
  45. }
  46. }
  47. public function padApplyJobs($where)
  48. {
  49. return $this->model->has('resumes')->has('putJobs')
  50. ->where($where)->where(function ($query) {
  51. $query->where(['is_apply'=>1,'is_interview'=>1])
  52. ->orWhere(['is_apply'=>2]);
  53. })->paginate(10);
  54. }
  55. public function interviewAdd($data)
  56. {
  57. return $this->model->create($data);
  58. }
  59. public function interviewEdit($id)
  60. {
  61. $interview=$this->model->find($id);
  62. $interview->is_interview=1;
  63. return $interview->save();
  64. }
  65. /*
  66. * 判断是否已投递
  67. */
  68. public function applyFind($where){
  69. return $res = $this->model->where($where)->first();
  70. }
  71. /*
  72. * 判断是否已邀请
  73. */
  74. public function interviewFind($where){
  75. $res = $this->model->where($where)
  76. ->where(function ($query) {
  77. $query->where(['is_apply'=>1,'is_interview'=>1])
  78. ->orWhere(['is_apply'=>2])->first();
  79. })->first();
  80. return $res ? true : false;
  81. }
  82. //删除
  83. public function delete($where){
  84. return $this->model->where($where)->delete();
  85. }
  86. //获取个人所投简历
  87. public function getPersonApply($where,$limit,$page){
  88. return $this->model->with(['putJobs'=>function($query){
  89. $query->with('jobs');
  90. }])->where($where)->paginate($limit,['*'],'page',$page);
  91. }
  92. public function applyJobsPage($where,$limit,$page)
  93. {
  94. return $this->model
  95. ->with(['jobfairs','resumes','putJobs'])
  96. ->where($where)->where(function ($query) {
  97. $query->where(['is_apply'=>1,'is_interview'=>1])
  98. ->orWhere(['is_apply'=>2]);
  99. })->paginate($limit,['*'],'page',$page);
  100. }
  101. public function getJobsApply($where)
  102. {
  103. return $this->model->where($where)->orderBy('id', 'desc')->get();
  104. }
  105. public function getResumeJobs($com_id,$where,$where1){
  106. return $this->model
  107. ->whereHas('jobfairs')
  108. ->whereHas('resumes')
  109. ->whereHas('putJobs',function($query) use ($where1){
  110. $query->whereHas('jobs',function($query) use ($where1){
  111. $query->where($where1);
  112. });
  113. })
  114. ->where(['company_id'=>$com_id])
  115. ->where($where)
  116. ->orderBy("updated_at", 'desc')
  117. ->paginate(10);
  118. }
  119. public function getPluck($where,$colunm)
  120. {
  121. return $this->model->where($where)->pluck($colunm);
  122. }
  123. }