PersonFocusComRepository.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. namespace App\Repositories;
  3. use App\Models\PersonFocusCompany;
  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 PersonFocusComRepository extends BaseRepository
  12. {
  13. /**
  14. * Specify Model class name
  15. *
  16. * @return string
  17. */
  18. public function model()
  19. {
  20. return PersonFocusCompany::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 getAttionCom($data,$where)
  30. {
  31. return $this->model->with(['jobs'=>function($query) use ($where) {
  32. $query->whereIn('audit', $where)->where('display', 1)->where('valid', 1);
  33. $query->whereHas('subsiteJobs',function ($query){
  34. $query->where('subsite_id',get_subsite_id());
  35. });
  36. },'companys'])->whereHas('companys')->where($data)->orderBy('id', 'desc')->paginate(4);
  37. }
  38. public function concern($where, $page = 10)
  39. {
  40. return $this->model->with('resumes')->Where($where)->paginate($page);
  41. }
  42. public function concernDel($ids,$company_id)
  43. {
  44. return $this->model->whereIn('id', $ids)->where("company_id",$company_id)->delete();
  45. }
  46. //获取企业粉丝数量
  47. public function getFansCount($where)
  48. {
  49. return $this->model->where($where)->count();
  50. }
  51. public function getFocus($where)
  52. {
  53. return $this->model->where($where)->first();
  54. }
  55. public function deleteFocus($where)
  56. {
  57. return $this->model->where($where)->delete();
  58. }
  59. public function addFocus($data)
  60. {
  61. return $this->model->create($data);
  62. }
  63. }