protected function createItem(Order $order, array $item)
    {
        if ($this->itemContainsABuyable($item)) {
            /** @var Buyable $product */
            $product = $item['product'];
            $item    = array_merge($item, [
                'product_type' => $product->morphTypeName(),
                'product_id'   => $product->getId(),
                'price'        => $product->getPrice(),
                'name'         => $product->getName()
            ]);
            unset($item['product']);
        }

        $order->items()->create($item);
    }
protected function createItem(Order $order, array $item)
    {
        if ($this->itemContainsABuyable($item)) {
            /** @var Buyable $product */
            $product = $item['product'];
            $item    = array_merge($item, [
                'product_type' => $product->morphTypeName(),
                'product_id'   => $product->getId(),
                'price'        => $product->getPrice(),
                'name'         => $product->getName()
            ]);
            unset($item['product']);
        }

        $order->items()->create($item);
    }
protected function createItem ( Order $ order , array $ item ) { if ( $ this -> itemContainsABuyable ( $ item ) ) { /** @var Buyable $product */ $ product = $ item [ 'product' ] ; $ item = array_merge ( $ item , [ 'product_type' => $ product -> morphTypeName ( ) , 'product_id' => $ product -> getId ( ) , 'price' => $ product -> getPrice ( ) , 'name' => $ product -> getName ( ) ] ) ; unset ( $ item [ 'product' ] ) ; } $ order -> items ( ) -> create ( $ item ) ; }
Creates a single item for the given order

@param Order $order
@param array $item
Creates a single item for the given order