title: Laravel livewire wire:model with array
body: <p>From blade component I can give valule product_id</p>
  <pre><code>&lt;input wire:model=&quot;qty.{{$row-&gt;product_id}}&quot; value=&quot;{{$row-&gt;qty}}&quot; max=&quot;{{$row-&gt;stock}}&quot;&gt;
  </code></pre>
  <p>but how I can display qty from database and when increase qty then wire model will work and updated, what I can should do???</p>
  <pre><code>public $qty;
      
  
      public function render()
      {
          $this-&gt;userId=Auth::id();
  
          if ($this-&gt;qty!=null){
  
              foreach($this-&gt;qty as $key =&gt; $qty)
              {
                  $cart=Cart::where('user_id',$this-&gt;userId)-&gt;where('product_id',$key)-&gt;first();
  
                  if ($cart){
                      $cart-&gt;update([
                          'qty'    =&gt;  $qty,
                      ]);
                      $this-&gt;emit('refreshCart');
                  }
  
              }
  
          }
  
      }
  </code></pre>