I had that problem the first year at this house. I put down straw mulch and it did help.
I tried the trick of filling 2 liter jugs and had no luck with that. (its supposed to frighten them)
In subsequent years they have not been using my garden as a cat box.
Not sure if it was because the previous tenatts had a bunch of cats and they had used the garden area as a catbox too, or if I just broke their habit with the straw. Or because I got two cats of my own.