laravel-api-handler icon indicating copy to clipboard operation
laravel-api-handler copied to clipboard

Allow to selectively use soft-deleted entities

Open sixty-nine opened this issue 7 years ago • 1 comments
trafficstars

It would be great to have a flag to allow the API handler to also use soft-deleted entities (deleted_at not null) as Laravel allows it easily with:

Model::withTrashed()->get();

I guess you have an idea on which project this could help ;)

Cheers, Dan

sixty-nine avatar Oct 29 '18 10:10 sixty-nine

This issue can be resolved by passing $myModel::withTrashed() as first parameter to parseMultiple().

But if this is done on the basis of some query parameters, then there are some annoying steps to do before:

  • check if the query string has the param to indicate to also consider soft-deleted
  • remove this param from the query string so that it is not used by the handler
  • and finally send the right model to parseMultiple().

sixty-nine avatar Oct 29 '18 10:10 sixty-nine