public function register($data) { if (!$data['email']) { throw new Exception("email address could not be null"); } if (!$data['password']) { throw new Exception("password could not be null"); } //check email $isExist = $this->_isEmailExist($data['email']); if ($isExist) { throw new Exception("sorry, email address already exist"); } $data['password'] = md5($data['password']); $data['date_add'] = time(); $this->_model->insert($data); }