FutureWeb
4 months ago

Grouping by distant relationships

Posted 4 months ago by FutureWeb

Hiya LaraFloks,

I am trying to group by a distant relationship:

an order hasMany products a Product hasMany Options an Option hasOne DeliveryMethod (and all options for one product have the same DeliveryMethod)

so when looping over all $order->products :

	@foreach($order->products as $product)

I would like them grouped or ordered by the DeliveryMethod I am guessing the only way I could do it is to loop over the collection in my controller and build a new collection in the order I want?

Please sign in or create an account to participate in this conversation.