Disconnect the power to the garage door opening at the outlet, and remove the wing nut holding the damaged eye to the bracket.
Follow the wire from the back of the eye to the motor head. Press the button on the bottom of the wiring connection to release the wires after making a note of how the eye is connected.
Connect the wires at the end of the replacement eye in the same manner as the old one, and run the cable to the mounting bracket at the door.
Screw the new eye to the bracket with the wing nut and connect the power. You might have to change the angle of the new eye of the sensor so it lines up with the sensor on the opposite side if the system does not work right away. Some models have an indicator light on the eye that indicates when the beam is aligned.
Open the garage door as a test. The door should not close if there is an object obstructing the beam.