PersonJobsSubRepository.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. namespace App\Repositories;
  3. use App\Models\PersonJobsSubscribe;
  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 PersonJobsSubRepository extends BaseRepository
  12. {
  13. /**
  14. * Specify Model class name
  15. *
  16. * @return string
  17. */
  18. public function model()
  19. {
  20. return PersonJobsSubscribe::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 getJobsSub($data)
  30. {
  31. return $this->model->where($data)->orderBy('id', 'desc')->get();
  32. }
  33. public function getJobsSubAdd($data)
  34. {
  35. return $this->model->create($data);
  36. }
  37. public function getJobsById($id)
  38. {
  39. return $this->model->find($id);
  40. }
  41. public function getJobsSubUpdate($data, $id)
  42. {
  43. return $this->model->where('id', $id)->update($data);
  44. }
  45. public function getJobsAddVar($data)
  46. {
  47. return $this->model->where($data)->count();
  48. }
  49. public function getJobsSubDel($id)
  50. {
  51. return $this->model->where('id', $id)->delete();
  52. }
  53. public function rateDate($data)
  54. {
  55. return $this->model->where($data)->where('updated_at', '>=', date('Y-m-d 00:00:00'))
  56. ->where('updated_at', '<=', date('Y-m-d 23:59:59'))->get();
  57. }
  58. public function rateDateCount($data)
  59. {
  60. return $this->model->where($data)->select('*')->count();
  61. }
  62. public function getPersonJobsSub($where)
  63. {
  64. return $this->model->where($where)->first();
  65. }
  66. }