How to increment value when the button click laravel 5.3
<p>im using laravel 5.3 and the project is shooping cart 
When I click the items the quantity is not increment </p>

<p>the Product Controll</p>

<pre><code>public function getAddToCart(Request $request, $id)
{
  $product  =Product::find($id);
  $oldcart = Session::has('cart') ? Session::get('cart') : null;
  $cart = new Cart($oldcart);
  $cart-&gt;add($product , $product-&gt;id);

  $request-&gt;session()-&gt;put('cart',$cart);
// TO show it  dd($request-&gt;Session()-&gt;get('cart'));
  return redirect()-&gt;route('product.index');
}
</code></pre>

<p>and the model Cart :</p>

<pre><code> class Cart
 {
 public $items = null;
public $totalQty = 0;
public $totalPrice = 0;

public function __consruct($oldCart){
  if($oldCart){
    $this-&gt;$items = $oldCart-&gt;items;
    $this-&gt;$totalQty  = $oldCart-&gt;totalQty;
    $this -&gt;$totalPrice = $oldCart-&gt;totalPrice;
  }

}
   public function add($item,$id){
    $storedItem = ['qty' =&gt; 0,'price' =&gt; $item-&gt;price,'item' =&gt; $item];
    if ($this-&gt;items)
    {
      if(arrary_Key_exists($id,$this-&gt;items))
      {
        $storedItem = $this-&gt;items[$id];
      }
    }
      $storedItem['qty']++;
      $storedItem['price'] = $item-&gt;price * $storedItem['qty'];
      $this-&gt;items[$id] = $storedItem;
      $this-&gt;totalQty++;
      $this-&gt;totalPrice += $item-&gt;price;

  }

  }
</code></pre>

<p>And this is a Product page:</p>

<pre><code>  &lt;a href="#"&gt; &lt;i class="fa fa-shopping-cart" aria-hidden="true"&gt;&lt;/i&gt; Shopping Cart
        &lt;span class="badge"&gt;{{ Session::has('cart') ? Session::get('cart')-&gt;totalQty : '' }}&lt;/span&gt;
      &lt;/a&gt;
</code></pre>

<p>it should add the item and increment but it's just show the id of item with out increment it . </p>