Phoenix wright CAKE attorney (Or phoenix wrighte cake attorney as it's spelled on fanfiction.net) is the sixth main series fic by jakkid166. It's the first part of Phoenix Wright Turnabout Portal, posted as a separate story, for some reason.
The story opens with Phoenix Wright mourning the death of his cat, Mr. Squipples. After some time, he receives a package in the mail that contains a cake from Pearl, along with a note apologizing for getting him convicted of kidnapping. However, when he takes the cake out, it explodes and knocks him unconscious.
Phoenix wakes up in the hospital with Maya next to him. Maya tells him that Pearl was arrested for attempted murder as a result of the cake. Phoenix, of course, took her cas,e and went to investigate his office, which was now coated completely in cake. Eventually, he and Gumshoe trace the cake back to Manfred von Karma, who's somehow out of prison on parole. However, von Karma escapes them in his car, flipping them off in the process. After a long police chase, von Karma crashes his car and gets flung onto a building, after which he jumps off the building and falls through a conveniently-placed portal.
Phoenix and Gumshoe chase him through the portal, leading directly into Phoenix Wright Turnabout Portal.