How to manage logic of Model responses data?

Hi all,

i want to know how you manage your logic of data responses witohut repeat code in all your application (for custom endpoints not for graphql).

In some cases i want to response some data of one Model and in other cases i want to response other some data about the same Model.

How would you handle the responses of your api in these cases?

I think that doing the query to the database and then in the controller doing a "delete . to hide a data is not very maintainable and that private fields are not a solution either

thanks!!

1 Like