ViewResumeRepository.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. namespace App\Repositories;
  3. use App\Models\ViewResume;
  4. use Prettus\Repository\Eloquent\BaseRepository;
  5. use Prettus\Repository\Criteria\RequestCriteria;
  6. /**
  7. * Class MemberRepositoryEloquent.
  8. *
  9. * @package namespace App\Repositories;
  10. */
  11. class ViewResumeRepository extends BaseRepository
  12. {
  13. /**
  14. * Specify Model class name
  15. *
  16. * @return string
  17. */
  18. public function model()
  19. {
  20. return ViewResume::class;
  21. }
  22. /**
  23. * Boot up the repository, pushing criteria
  24. */
  25. public function boot()
  26. {
  27. $this->pushCriteria(app(RequestCriteria::class));
  28. }
  29. /**
  30. * 获取简历的关注数。
  31. * @param $resume_id
  32. * @return mixed
  33. */
  34. public function getViewResume($resume_id)
  35. {
  36. return $this->model->with(['companys','resumes'])->whereIn('resume_id', $resume_id)->whereHas('companys')->whereHas('resumes')->count();
  37. }
  38. /**浏览过的简历
  39. * @param $where
  40. * @param $page
  41. * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
  42. */
  43. public function browseList($where, $id, $page)
  44. {
  45. return $this->model->with('resumes')->where($where)->where('uid', $id)->orderBy('id', 'desc')->paginate($page, ['*']);
  46. }
  47. /**删除浏览过的简历
  48. * @param $ids
  49. * @param $company_id
  50. * @return mixed
  51. */
  52. public function browseResumeDel($ids,$company_id)
  53. {
  54. return $this->model->whereIn('id', $ids)->where("uid",$company_id)->delete();
  55. }
  56. //获取简历查看信息
  57. public function findViewResume($where)
  58. {
  59. return $this->model->where($where)->first();
  60. }
  61. public function getAttentMe($where, $resume_id)
  62. {
  63. return $this->model->with(['companys','resumes'])->where($where)->whereIn('resume_id', $resume_id)->whereHas('companys')->whereHas('resumes')->orderBy('id', 'desc')->paginate(10);
  64. }
  65. }