JobsContactRepository.php 987 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: wuzhenke
  5. * Date: 2018/11/9
  6. * Time: 15:40
  7. */
  8. namespace App\Repositories;
  9. use App\Models\JobsContact;
  10. use Prettus\Repository\Criteria\RequestCriteria;
  11. use Prettus\Repository\Eloquent\BaseRepository;
  12. class JobsContactRepository extends BaseRepository
  13. {
  14. public function model()
  15. {
  16. return JobsContact::class;
  17. }
  18. /**
  19. * Boot up the repository, pushing criteria
  20. */
  21. public function boot()
  22. {
  23. $this->pushCriteria(app(RequestCriteria::class));
  24. }
  25. public function store($data)
  26. {
  27. return $this->model->create($data);
  28. }
  29. public function update(array $data, $id)
  30. {
  31. return $this->model->where('job_id', $id)->update($data);
  32. }
  33. public function getContactInfo($where)
  34. {
  35. return $this->model->where($where)->first();
  36. }
  37. public function delJobsContact($jobs_id)
  38. {
  39. return $this->model->whereIn('job_id', $jobs_id)->delete();
  40. }
  41. }