liefie's avatar

Adding multiple elements to collection

What's the best way to add multiple elements to a collection.

e.g. ($this->order_items) is a collection. I want to append another collection.

public function setOrderItems($order_item_list)
{
    Order\OrderItem::whereIn('id', $order_item_list)->get()->each(function (Order\OrderItem $order_line) {
        $this->order_items->push($order_line);
    });
}
1 like
1 reply

Please or to participate in this conversation.