username = $this->request->username(); $this->uid = $this->request->uid(); $this->campus_id = ''; $person = new Personnel(); $campusPersonRole = new CampusPersonRole(); if($this->uid > 1){ $person_id = $person->where(['sys_user_id' => $this->uid])->value("id"); $role_info = $campusPersonRole->where(['person_id' => $person_id])->find(); if (in_array($role_info['role_id'], [1, 7])) { $this->campus_id = ''; }else{ $this->campus_id = $role_info['campus_id']; } } } }