0

I am using the approach detailed here to add a restore method to my resource routes. I think it's an elegant solution to what would be a very messy routes file if a separate route had to be applied to each resource.

The problem I have is that I have deeply nested routes which resolve the component models prior to hitting the controller, and which automatically apply WHERE deleted_at IS NULL to queries. I am therefore getting 404 errors when I hit the restore method in my controllers.

Can anyone suggest an elegant way of getting around this for the custom restore method I have assigned to my resource routes?

Ideally it would only be the last parameter of the route that should be selecting withTrashed().

Thanks

rightwayround
  • 177
  • 3
  • 11
  • I would just advice stripping complicated solutions and use a not very messy way but relatively simple. You said >**I have is that I have deeply nested routes** and that makes me think that your project won't be easy to understand for another dev (and potentially you in the futur). I prefer adding one or two of route lines next to the ressource route. – medilies Feb 23 '22 at 19:44

0 Answers0