ResumeCredentRepository.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. namespace App\Repositories;
  3. use App\Models\ResumeCredent;
  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 ResumeCredentRepository extends BaseRepository
  12. {
  13. /**
  14. * Specify Model class name
  15. *
  16. * @return string
  17. */
  18. public function model()
  19. {
  20. return ResumeCredent::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 getResumeCredentByResumeId($resume_id)
  30. {
  31. return $this->model->where('resume_id', $resume_id)->orderByRaw('year desc,month desc')->get()->toArray();
  32. }
  33. public function resumeCredentAdd($date)
  34. {
  35. return $this->model->create($date);
  36. }
  37. public function getResumeById($id)
  38. {
  39. return $this->model->find($id)->toArray();
  40. }
  41. public function updateResume($data, $id)
  42. {
  43. return $this->update($data, $id);
  44. }
  45. public function resumeCredentDelete($id)
  46. {
  47. return $this->delete($id);
  48. }
  49. public function getResumeCredentCount($resume_id)
  50. {
  51. return $this->model->where('resume_id', $resume_id)->count();
  52. }
  53. public function getCredentByU($resume_id, $uid)
  54. {
  55. return $this->model->where(['resume_id'=>$resume_id,'uid'=>$uid])->get();
  56. }
  57. public function addInsert($date)
  58. {
  59. return $this->model->insert($date);
  60. }
  61. public function getResumeCredent($where)
  62. {
  63. return $this->model->where($where)->first();
  64. }
  65. }