Use digital potentiometer and transistor to drive pigtailed laser diode

Definitely you need constant current circuit, and the right current. Don't expect much range
of adjustment - too much current the device will be damaged, too little and it will become
just an expensive LED, not a laser.

Perhaps you are expecting a linear brightness response from a laser diode? The physics is
against you, they aren't like that.

Almost any use of a digital pot is a mistake here - mostly we see on these forums circuits that are
better done with a DAC and an opamp. The normal exception is controlling an audio signal volume
where you have an analog signal to modulate, not an analog voltage/current to generate.

DACs generate an analog signal, pots modulate an existing analog signal.