Cats dig soil to cover their faeces and urine, and garden beds and yards with bare soil attracts them. This is damaging to the soil and can disturb your flowers, but there are methods that prevent cats from soiling your garden and yard.
Cats dislike the smell of citrus, so take your leftover citrus rinds, shred them up and scatter them in places in your yard or garden that attract cats.
Scatter large stones in the areas where cats relieve themselves. Cats need to dig the earth before they can relieve themselves and the stones will discourage them.
Spray the cats with water from the hose whenever you see them in the garden. If this happens enough they'll associate repeated soakings with the area and avoid it.
Scatter pine cones in the areas where the cats are relieving themselves. The pine cones are prickly for the cat's feet, and they'll avoid those locations.
Cover the ground where the cats tend to scratch with chicken wire. Chicken wire snags the cat's claws and prevents them from scratching.