Opioids used to be the go-to choice for treating surgical patients’ pain.