This lateral was cut by a landscaper when he removed a stump, that is the reason the hole is so large.
Cut out the damaged section.
If there is residual water in the lateral, allow it to drain fully before you attempt gluing.
Here I am using the bell end of the pipe to couple the new pipe to the damaged lateral. Common fittings used for these repairs: Bell end, Coupling, Slip Fix, Compression Coupling or a Tee (for connecting a swing joint for adding or replacing a sprinkler head).
Now that one end of the new pipe is glued, cut the opposite end of the pipe so that they can line up with each other, but not quite touching. There should be a very small gap to accommodate the small ridge at the bottom of the new coupling that will be installed next.
When gluing this fitting together you will have to bend the pipe so that the fittings can be forced together. If you do not have enough space to bend the pipes, you may have to use a slip fix in conjunction with the coupling. If this is a lateral, you may not need primer as long as your glue is rated to be used without primer.
This is what the repair looks like when complete.