ResumeEntrustRepository.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace App\Repositories;
  3. use App\Models\ResumeEntrust;
  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 ResumeEntrustRepository extends BaseRepository
  12. {
  13. /**
  14. * Specify Model class name
  15. *
  16. * @return string
  17. */
  18. public function model()
  19. {
  20. return ResumeEntrust::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 getEntrustByResumeId($resume_id)
  30. {
  31. return $this->model->with('resumes')->where(['resume_id'=>$resume_id])->first();
  32. }
  33. public function addEnteust($data)
  34. {
  35. return $this->model->create($data);
  36. }
  37. public function updateEntrust($resume_id, $data)
  38. {
  39. return$this->model->where(['resume_id'=>$resume_id])->update($data);
  40. }
  41. public function resumeEntrust()
  42. {
  43. return $this->model->whereHas('resumes',function ($query){
  44. $query->where('display',1)->whereIn('audit',getResumeStatus());
  45. })->with('resumes')->where('entrust_end','>=',time())->get()->toArray();
  46. }
  47. public function delRefreshResume($where)
  48. {
  49. return $this->model->where($where)->delete();
  50. }
  51. }