/** * Create or Update an AdminRole entry! */ public function editAdminRoleAction() { $now = date('Y-m-d H:i:s'); $roleId = $this->request->getPost('role_id'); if ($roleId) { $role = KxAdminRole::findFirst($roleId); $role->update_time = $now; } else { $role = new KxAdminRole(); $role->status = 1; $role->access_status = 1; $role->create_time = $now; $role->update_time = $now; } $role->name = $this->request->getPost('name'); $role->remark = $this->request->getPost('remark'); $role->save(); parent::redirect('kxAdminRole'); }