public function registerPreValidateAction() { if ($this->request->isPost()) { if ($this->request->isAjax()) { $role_name = $this->request->getPost('roleName'); $find = AclRoles::findFirstByName($role_name); if ($find === false) { $payload = array('error' => 0); } else { $payload = array('error' => 1, 'message' => _('This name is already assigned')); } return $this->sendAjax($payload); } } }
public function getRoles() { return AclRoles::find()->toArray(); }
public function getRolesAction() { if ($this->request->isPost()) { if ($this->request->isAjax()) { $roles = AclRoles::find()->toArray(); return $this->sendAjax($roles); } } }