Hello! Can you please help me with the following situation.
I have a collection of orders. I also have a "hasMany" relationship with an items table that contains basically the lines of the order (products). I want to find out how many pieces of each product I need in order to satisfy the necessity of those orders.
What can't be seen in the item collection is a product_id field and also the product_quantity filed.
Practically, out of this I would like to get the total number of products I need, in order for all of those orders to be fulfilled.
@leinad95 I don’t really understand the question, and the “debug” output doesn’t really help as it’s not formatted nor expandable.
Nevertheless, take a look at the available methods for collections. If you’re wanting to pull “nested” records, then sounds like you’re looking for something like pluck or flatMap.