title: Laravel livewire store array cannot stored data
body: <p>I have a input field and this input field is multiple input . i have problem to store this input to database because i think i have mistake  on create this query input . its my input field</p>
  <pre><code>&lt;form&gt;
  &lt;button wire:click.prevent=&quot;add()&quot;&gt;
      Add
  &lt;/button&gt;
  
  @foreach($inputs as $key =&gt; $value)
  &lt;input type=&quot;hidden&quot; wire:model=&quot;inputs.{{ $key }}.newid&quot; value=&quot;{{ $key }}&quot;&gt;
  &lt;input wire:model=&quot;inputs.{{ $key }}.nama_barang&quot; type=&quot;text&quot; /&gt;
  &lt;input wire:model=&quot;inputs.{{ $key }}.qtt&quot; type=&quot;text&quot; /&gt;
  &lt;input wire:model=&quot;inputs.{{ $key }}.price&quot; type=&quot;text&quot; /&gt;
  &lt;input wire:model=&quot;inputs.{{ $key }}.qty&quot; type=&quot;text&quot; /&gt;
  &lt;input value=&quot;{{ (int)$value['price'] * (int)$value['qty']  }}&quot; type=&quot;text&quot; /&gt;
  &lt;br&gt;
  @endforeach
  
  &lt;button wire:click.prevent=&quot;store()&quot;&gt;Submit&lt;/button&gt;
  </code></pre>
  
  <p>and its my livewire function</p>
  <pre><code> public $belanja_id, $nama_barang, $qtt,$newid;
  public $updateMode = false;
  
  public $i = 1;
  public $total ;
  public $price= [] ;
  public $qty = [];
  
  public $inputs = [
      [
          &quot;newid&quot; =&gt; &quot;&quot;,
          &quot;nama_barang&quot; =&gt; &quot;&quot;,
          &quot;qtt&quot; =&gt; &quot;&quot;,
          &quot;price&quot; =&gt; &quot;&quot;,
          &quot;qty&quot; =&gt; &quot;&quot;,
          &quot;total_price&quot; =&gt; &quot;&quot;,
      ]
  ];
  
  public function add($i)
  {
      array_push($this-&gt;inputs, [
          &quot;newid&quot; =&gt; &quot;&quot;,
          &quot;nama_barang&quot; =&gt; &quot;&quot;,
          &quot;qtt&quot; =&gt; &quot;&quot;,
          &quot;price&quot; =&gt; &quot;&quot;,
          &quot;qty&quot; =&gt; &quot;&quot;,
          &quot;total_price&quot; =&gt; &quot;&quot;,
      ]);
  }
   public function store()
  {
    
      foreach ($this-&gt;inputs as $key =&gt; $value) {
          $bel = AnakBelanja::create([
              'belanja_id' =&gt; $this-&gt;newid,
              'nama_barang' =&gt; $this-&gt;nama_barang[$key], 
              'qtt' =&gt; $this-&gt;qtt[$key],
              'price' =&gt; $this-&gt;price[$key],
              'qty' =&gt; $this-&gt;qty[$key]
              ]);        
          }
  
      $this-&gt;inputs = [];
  
      $this-&gt;resetInputFields();
  
  
      return redirect()-&gt;route('detail', $bel-&gt;belanja_id);
  
  }
  </code></pre>
  <p>this input have error</p>
  <blockquote>
  <p>Trying to access array offset on value of type null</p>
  </blockquote>
  <p>can someone help this ? thank you</p>