PersonJobsApplyRepository.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace App\Repositories;
  3. use App\Models\PersonalJobsApply;
  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 PersonJobsApplyRepository extends BaseRepository
  12. {
  13. /**
  14. * Specify Model class name
  15. *
  16. * @return string
  17. */
  18. public function model()
  19. {
  20. return PersonalJobsApply::class;
  21. }
  22. /**
  23. * Boot up the repository, pushing criteria
  24. */
  25. public function boot()
  26. {
  27. $this->pushCriteria(app(RequestCriteria::class));
  28. }
  29. public function getJobsApply($data, $where)
  30. {
  31. return $this->model->with(['resumes','jobs'=>function($query) use($where) {
  32. $query->whereIn('audit', $where)->where('display', 1)->where('valid', 1);
  33. }])->where($data)->whereHas('resumes')->whereHas('jobs')->orderBy('id', 'desc')->paginate(10);
  34. }
  35. public function getJobsApplyCount($uid, $where)
  36. {
  37. return $this->model->with(['resumes','jobs'=>function($query) use ($where) {
  38. $query->whereIn('audit', $where)->where('display', 1)->where('valid', 1);
  39. }])->where(['personal_uid'=>$uid])->whereHas('resumes')->whereHas('jobs')->count();
  40. }
  41. public function delApplyJobs($id)
  42. {
  43. return $this->model->whereIn('id', $id)->delete();
  44. }
  45. public function applyJons($data)
  46. {
  47. return $this->model->insert($data);
  48. }
  49. public function personApplyByTime($jobs_id, $uid, $date)
  50. {
  51. return $this->model->whereIn('jobs_id', $jobs_id)->where('personal_uid', $uid)->where('created_at', '>=', date('Y-m-d H:i:s', strtotime("-{$date} day")))->where('created_at', '<=', date('Y-m-d H:i:s', strtotime("{$date} day")))->get()->toArray();
  52. }
  53. public function getTodayCount($uid)
  54. {
  55. return $this->model->where('personal_uid', $uid)->where('created_at', '>=', date('Y-m-d 00:00:00'))->where('created_at', '<=', date('Y-m-d 23:59:59'))->count();
  56. }
  57. }