I only have a mobile device to connect to the internet at the moment so I can't easily draw schematics but this is how you do it:
Two methods, both similar:
Connect the emitter of the new NPN transistor to ground.
Connect the collector of the new transistor to the bottom of the load.
(the new transistor is wired like the one already in the opto-coupler)
Method 1.
Connect the collector of the opto transistor to the output of the LM317.
Connect the emitter of the opto transistor to the base of the new transistor through a 1K resistor.
Connect the base of the new transistor to ground through a new 100K resistor.
Method 2:
Leave the emitter of the opto transistor comnnected to ground.
Connect the collector of the opto transistor to the base of the new transistor.
Connect a new 1K resistor between the base/opto junction and the output of the LM317.
Method 2 uses one less component but it inverts the way the logic drive works. In other words, the laser is on when the logic input is high instead of low. You may need to change the software to reverse the activation signal.
The resistor in series with the LED side of the optocoupler is calculated by:
(VCC - Forward voltage of the LED)/LED current. Use the data sheet to find the optimum current for your chosen device. For example if VCC is 5V and Vf is 1.6V and the LED was to pass 10mA, the resistor would be (5 - 1.6)/0.01 = 340 Ohms so the nearest standard value would be 330 Ohms.
Brian.