uri_path .= strtolower($this->getService()->getClassName()) . '/'; $this->class_path = $this->getService()->getClassPath(); $this->title = lang("{$this->getService()->getClassPath()}.title"); $this->helper = $this->getHelper(); } final public function getService(): UserService { if (!$this->_service) { $this->_service = new UserService($this->request); } return $this->_service; } public function getHelper(): mixed { if (!$this->_helper) { $this->_helper = new UserHelper($this->request); } return $this->_helper; } //Index,FieldForm관련 protected function setValidation(Validation $validation, string $action, string $field, ?string $rule = null): Validation { switch ($field) { case 'role': //아래 Rule Array는 필드명.* checkbox를 사용 $validation->setRule("{$field}.*", $field, $rule); break; default: $validation = parent::setValidation($validation, $action, $field, $rule); break; } return $validation; } //Index,FieldForm관련. public function getFields(): array { return ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role']; } protected function getResultPageByActon(string $action, string $message = MESSAGES["SUCCESS"]): RedirectResponse|string { switch ($action) { case 'create': case 'modify': $this->getHelper()->setViewDatas($this->getViewDatas()); $result = view($this->view_path . 'view', ['viewDatas' => $this->getViewDatas()]);; break; default: $result = parent::getResultPageByActon($action, $message); break; } return $result; } //View관련 protected function view_process($uid): mixed { $fields = [ 'fields' => ['id', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role', 'status'], ]; $this->init('view', $fields); return parent::view_process($uid); } protected function index_process(): array { $fields = [ 'fields' => ['id', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role', 'status'], ]; $this->init('index', $fields); return parent::index_process(); } }