| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 | <?phpnamespace App\Repositories;use App\Models\PersonalJobsApply;use Prettus\Repository\Eloquent\BaseRepository;use Prettus\Repository\Criteria\RequestCriteria;/** * Class MemberRepositoryEloquent. * * @package namespace App\Repositories; */class PersonJobsApplyRepository extends BaseRepository{    /**     * Specify Model class name     *     * @return string     */    public function model()    {        return PersonalJobsApply::class;    }    /**     * Boot up the repository, pushing criteria     */    public function boot()    {        $this->pushCriteria(app(RequestCriteria::class));    }    public function getJobsApply($data, $where)    {        return $this->model->with(['resumes','jobs'=>function($query) use($where) {            $query->whereIn('audit', $where)->where('display', 1)->where('valid', 1);        }])->where($data)->whereHas('resumes')->whereHas('jobs')->orderBy('id', 'desc')->paginate(10);    }    public function getJobsApplyCount($uid, $where)    {        return $this->model->with(['resumes','jobs'=>function($query) use ($where) {            $query->whereIn('audit', $where)->where('display', 1)->where('valid', 1);        }])->where(['personal_uid'=>$uid])->whereHas('resumes')->whereHas('jobs')->count();    }    public function delApplyJobs($id)    {        return $this->model->whereIn('id', $id)->delete();    }    public function applyJons($data)    {        return $this->model->insert($data);    }    public function personApplyByTime($jobs_id, $uid, $date)    {        return $this->model->whereIn('jobs_id', $jobs_id)->where('personal_uid', $uid)->where('created_at', '>=', date('Y-m-d H:i:s', strtotime("-{$date} day")))->where('created_at', '<=', date('Y-m-d H:i:s', strtotime("{$date} day")))->get()->toArray();    }    public function getTodayCount($uid)    {        return $this->model->where('personal_uid', $uid)->where('created_at', '>=', date('Y-m-d 00:00:00'))->where('created_at', '<=', date('Y-m-d 23:59:59'))->count();    }}
 |