<?php namespace App\Repositories; use App\Models\ResumeEntrust; use Prettus\Repository\Eloquent\BaseRepository; use Prettus\Repository\Criteria\RequestCriteria; /** * Class MemberRepositoryEloquent. * * @package namespace App\Repositories; */ class ResumeEntrustRepository extends BaseRepository { /** * Specify Model class name * * @return string */ public function model() { return ResumeEntrust::class; } /** * Boot up the repository, pushing criteria */ public function boot() { $this->pushCriteria(app(RequestCriteria::class)); } public function getEntrustByResumeId($resume_id) { return $this->model->with('resumes')->where(['resume_id'=>$resume_id])->first(); } public function addEnteust($data) { return $this->model->create($data); } public function updateEntrust($resume_id, $data) { return$this->model->where(['resume_id'=>$resume_id])->update($data); } public function resumeEntrust() { return $this->model->whereHas('resumes',function ($query){ $query->where('display',1)->whereIn('audit',getResumeStatus()); })->with('resumes')->where('entrust_end','>=',time())->get()->toArray(); } public function delRefreshResume($where) { return $this->model->where($where)->delete(); } }