I was wondering if narcotic prescription medication would inhibit REM sleep or anything?

I use a narcotic pain killer for my migraines, it contains opium? And If i take that before bed would it have effects on my dreams?