laravel-api-handler
laravel-api-handler copied to clipboard
Allow to selectively use soft-deleted entities
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
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().