pushCriteria(app(RequestCriteria::class)); } public function getSetmealByUid($id, $utype) { return $this->model->where(['uid'=>$id,'utype'=>$utype])->first(); } public function modifyJobsMeanwhile($id, $count, $type) { if ($type == 1) { return $this->model->where('id', $id)->increment('jobs_meanwhile', $count); } else { $jobs_meanwhile = $this->find($id, ['jobs_meanwhile']); if ($jobs_meanwhile->jobs_meanwhile>$count) { return $this->model->where('id', $id)->decrement('jobs_meanwhile', $count); } else { return $this->model->where('id', $id)->update(['jobs_meanwhile'=>0]); } } } public function updateSetmeal($sqlData, $id) { return $this->model->where(['id'=>$id])->update($sqlData); } public function incrementData($where, $filed, $num = 1) { return $this->model->where($where)->increment($filed, $num); } public function decrementData($where, $filed, $num = 1) { return $this->model->where($where)->decrement($filed, $num); } public function getMemberSetmeals($company_ids) { if ($company_ids) { return $this->model->whereIn('uid', $company_ids)->get(); } else { return $this->model->get(); } } public function checkSetmeals($where,$or){ return $this->model->select("id")->where($where)->orWhere($or)->get(); } }