JobfairPersonalJobsApplyRepository.php 4.5 KB

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