Egg eating is usually from a deficiency or from boredom. Hens fed layer and then given treats or scratch can become deficient in protein. I feed a higher protein feed to offset the extras, 18-20% is a good protein level, layer generally only has 16%. A good non medicated grower or an all flock ration are good choices. Always provide an extra bowl of oyster shells which should prevent a calcium deficiency.
It can take some time for their bodies to recover from a deficiency, you can speed it up by providing an extra protein snack like some cottage cheese, scrambled eggs, or canned fish.
If they are confined too tightly kept, or not given range they may start eating eggs out of boredom. So make sure they have plenty of room and things to do. Make sure your nests are off the floor, slightly darkened and keep ceramic eggs in your nest to deter pecking.