function add_privilege($id, $uri) { $data = array('role_id' => $id, 'uri' => $uri); parent::before_save($data); $this->_db()->insert('privilege_role', $data); $this->cache->context_delete($this->CACHE_KEY_PRIVILEGE); }
function before_save(&$data, $id = null) { parent::before_save($data, $id); if (empty($data['password'])) { unset($data['password']); } else { $data['password'] = md5($data['password']); } }