So would you have to be IN the cockpit to do this, or would this be done from a distance? Say, a satellite or another aircraft?
It is typically done from other aircraft or spacecraft. It would not originate from within the target aircraft.
There was an array manufactured by the Russians in the 1980s. As I remember, it was towed behind a truck. Interspersed throughout the laser array, were VERY bright lights that would flash briefly....long enough to get the pilot's attention....at which point the lasers would fire and damage the pilot's eyes.