123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- /**
- * Created by PhpStorm.
- * User: ZhangHao
- * Date: 2019/6/17
- * Time: 11:12
- */
- namespace App\Repositories\Jobfairout;
- use App\Models\Jobfairout\Jobfairout;
- use Prettus\Repository\Eloquent\BaseRepository;
- class JobfairoutRepository extends BaseRepository
- {
- public function model()
- {
- return Jobfairout::class;
- }
- public function getJobfairList($com_id)
- {
- return $this->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();
- }
- }
|