Theory of the Injection of Relationships
We will learn how we can display user attributes in the output for product request.
Imagine a scenario where you go to the API to get the products, but you have to display some of the user’s information in this case.
One possible solution would be to add the attribute user_id
to the product_serializer
in order to get the corresponding user later. This may sound like a good idea, but if we are concerned about performance or our database ...