Overtrue\LaravelShoppingCart\Cart::updateRow PHP Method

updateRow() protected method

Update a row if the rawId already exists.
protected updateRow ( string $rawId, array $attributes ) : Item
$rawId string The ID of the row to update
$attributes array The quantity to add to the row
return Item
    protected function updateRow($rawId, array $attributes)
    {
        $cart = $this->getCart();
        $row = $cart->get($rawId);
        foreach ($attributes as $key => $value) {
            $row->put($key, $value);
        }
        if (count(array_intersect(array_keys($attributes), ['qty', 'price']))) {
            $row->put('total', $row->qty * $row->price);
        }
        $cart->put($rawId, $row);
        return $row;
    }