| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 | <?php/** * Created by PhpStorm. * User: ZhangHao * Date: 2019/6/17 * Time: 11:12 */namespace App\Repositories\Jobfairout;use App\Models\Jobfairout\JobfairoutCompany;use Prettus\Repository\Eloquent\BaseRepository;class JobfairoutCompanyRepository extends BaseRepository{    public function model()    {        return JobfairoutCompany::class;    }    public function getComCount($where)    {        return $this->model->where($where)->count();    }    public function findCompany($where, $offset = 0, $limit = 10)    {        return $this->model->with(['jobfairout'=>function ($query) {            $query->where('showendtime', '>=', time())->orWhere('showendtime', 0);        },'companys'])->where($where)->offset($limit*$offset)->limit($limit)->get();    }    public function getComList($where)    {        return $this->model->where($where)->select(['company_id'])->get();    }    public function findCom($where)    {        return $this->model->with(['companys','jobfairPutJob'=>function($query){            $query->with('jobs');        }])->where($where)->first();    }    public function jobfairAppointment($where)    {        return $this->model->where($where)->first();    }    public function findList($where)    {        return $this->model->whereHas('jobfairout')->where($where)->orderby('created_at', 'desc')->paginate(10);    }    public function getJobfair($com_id)    {        return $this->model->with(['jobfairout'=>function ($query) {            $query->where([['holddate_end', '>', time()]]);        }])->whereHas('jobfairout',function ($query){            $query->where([['holddate_end', '>', time()]]);        })->where(['company_id'=>$com_id])->where('audit','<>',3)->get();    }    public function findJob($where)    {        return $this->model->with(['jobfairout'=>function ($query) {            $query->where('showendtime', '>=', time())->orWhere('showendtime', 0);        }])->with('companys')->where($where)->get();    }    public function getCount($where, $subsite_id)    {        return $this->model->when($subsite_id,function ($query) use($subsite_id) {            $query->whereHas('jobfairout', function ($query) use($subsite_id) {                $query->where($subsite_id);            });        })->where($where)->count();    }    public function findListOption($com_id)    {        return $this->model->whereHas('jobfairout')->where(['company_id'=>$com_id])->groupBy('jobfair_id')->orderby('created_at', 'desc')->get();    }    public function getPluck($where,$column)    {        return $this->model->where($where)->pluck($column);    }    public function getValue($where,$column)    {        return $this->model->where($where)->value($column);    }}
 |