model->with(['jobfairoutCompany'=>function ($query) use ($com_id){ $query->where('company_id',$com_id); }])->where(function ($query) { $query->where('showendtime', '>=', time())->orWhere('showendtime', 0); })->where(['display'=>1])->orderBy('predetermined_status', 'asc')->orderBy('ordid', 'desc') ->orderBy('predetermined_end', 'desc')->paginate(10); } public function allJobfair($where, $page, $pageCount) { return $this->model->when(get_subsite_id()>0,function($query){ $query->whereHas('subsite', function ($query) { $query->where('subsite_id', get_subsite_id()); }); })->where($where)->Where(function ($query) { $query->where('showendtime', 0)->orWhere('showendtime', '>=', time()); })->orderBy('predetermined_status', 'asc')->orderBy('ordid', 'desc')->orderBy('predetermined_end', 'desc')->offset($page*$pageCount)->limit($pageCount)->get(); } public function findOne($where) { return $this->model->where($where)->where(function ($query) use ($where) { $query->where('showendtime', '>=', time())->orWhere('showendtime', 0); })->first(); } public function findJobfair($where) { return $this->model->where($where)->where(function ($query) { $query->where('showendtime', '>=', time())->orWhere('showendtime', 0); })->first(); } //允许预定的招聘会 public function getJobfairOpen() { return $this->model->where('predetermined_status', 1)->get(); } }