JobfairFloorplanStandRepository.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: wuzhenke
  5. * Date: 2019/1/28
  6. * Time: 10:49
  7. */
  8. namespace App\Repositories\Jobfair;
  9. use App\Models\Jobfair\FloorplanStand;
  10. use Prettus\Repository\Eloquent\BaseRepository;
  11. class JobfairFloorplanStandRepository extends BaseRepository
  12. {
  13. public function model()
  14. {
  15. return FloorplanStand::class;
  16. }
  17. public function standsTotal($where)
  18. {
  19. return $this->model->where($where)->select(['id'])->get();
  20. }
  21. public function getOne($where)
  22. {
  23. return $this->model->where($where)->first();
  24. }
  25. public function getOpenJobfair($where){
  26. return $this->model->with(['jobfair_company','jobfair'])->whereHas('jobfair', function ($query) {
  27. $query->where([
  28. ['holddate_start', '<', strtotime("+60 minute")],
  29. ['holddate_end', '>', time()],
  30. ['subsite_id',get_subsite_id()]
  31. ]);
  32. })->whereHas('jobfair_company',function($query){
  33. $query->where('audit',1);
  34. })->where($where)->first();
  35. }
  36. }