123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
- namespace App\Repositories;
- use App\Models\ViewJob;
- use Prettus\Repository\Eloquent\BaseRepository;
- use Prettus\Repository\Criteria\RequestCriteria;
- /**
- * Class MemberRepositoryEloquent.
- *
- * @package namespace App\Repositories;
- */
- class ViewJobRepository extends BaseRepository
- {
- /**
- * Specify Model class name
- *
- * @return string
- */
- public function model()
- {
- return ViewJob::class;
- }
- /**
- * Boot up the repository, pushing criteria
- */
- public function boot()
- {
- $this->pushCriteria(app(RequestCriteria::class));
- }
- public function attentionJobs($settr, $where)
- {
- return $this->model->with(['jobs'=>function($query) use($where) {
- $query->whereIn('audit', $where)->where('display', 1)->where('valid', 1);
- }])->whereDoesntHave('personSCompany')->where($settr)->orderBy('id', 'desc')->paginate(10);
- }
- public function delAttentionJobs($id)
- {
- return $this->model->whereIn('id', $id)->delete();
- }
- public function getLog($where, $limit = '')
- {
- if ($limit) {
- if ($limit == '1') {
- $list = $this->model->where($where)->orderBy('id', 'desc')->first();
- } else {
- $list = $this->model->where($where)->orderBy('id', 'desc')->limit($limit)->get();
- }
- } else {
- $list = $this->model->where($where)->get();
- }
- return $list;
- }
- public function update(array $data, $where)
- {
- return $this->model->where($where)->update($data);
- }
- public function addLog($data)
- {
- return $this->model->create($data);
- }
- /**谁看过我
- * @param $map
- * @param $page
- * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
- */
- public function browseJobs($map, $page, $company_id)
- {
- return $this->model->with('resumes')->where($map)->whereDoesntHave('personSCompany',function ($query) use ($company_id){
- $query->where('company_id', $company_id);
- })->orderBy('created_at', 'desc')->paginate($page, ['*']);
- }
- /**谁看过我count
- * @param $map
- * @return mixed
- */
- public function browseJobsCount($map)
- {
- return $this->model->where($map)->count();
- }
- /**删除谁看过我
- * @param $ids
- * @param $company_id
- * @return mixed
- */
- public function browseJobsDel($ids,$company_id)
- {
- return $this->model->whereIn('id', $ids)->where("company_id",$company_id)->delete();
- }
- }
|