title: Laravel-Array input can not be updated in database
body: <p>I have a table called Orders has one to many relationship with orderItems table when I want to update the 
  Array values of orderItems table it shows me this  Error Exception Array to string conversion and the values do not update in the database
  although when I use the dd() function it shows me all the array inputs 
  This my view (order-form)</p>
  
  <pre><code>@if(count($orders)&gt;0)
   @foreach ($orders as $order)
  &lt;form action="{{route('order.update',$order-&gt;id)}}" method="post"&gt;
  &lt;input type="hidden" value="PUT" name="_method"/&gt;
          @csrf
      &lt;input name="cus_name" type="text"  value={{$order-&gt;customerName}}&gt;&lt;br/&gt;
      &lt;input name="cus_address" type="text" value="{{$order-&gt;customerAddress}}"&gt;&lt;br/&gt;
      &lt;input name="order_date" type="date"  value="{{$order-&gt;orderDate}}"&gt;&lt;br/&gt;  
   @if(count($orderItems)&gt;0)
    @foreach ($orderItems as $orderItem)
      &lt;input name="productName[]" type="text" value="{{$orderItem-&gt;ProductName}}"&gt;&lt;br/&gt; 
      &lt;input name="Quantity[]" type="number"  value="{{$orderItem-&gt;Quantity}}"&gt;&lt;br/&gt;
      &lt;input name="price[]" type="number"  value="{{$orderItem-&gt;price}}" &gt;&lt;br/&gt; 
     @endforeach
    @endif
      &lt;button type="submit" &gt;update &lt;/button&gt;                    
  &lt;/form&gt;
  </code></pre>
  
  <p>And this is my orderController</p>
  
  <pre><code>    public function update(Request $request, $id)
  {
      $order_Data  = Order::where('id',$id)-&gt;update([
          'customerName' =&gt; $request-&gt;input('cus_name'),
          'customerAddress' =&gt; $request-&gt;input('cus_address'),
          'orderDate'  =&gt; $request-&gt;input('order_date')
      ]);
      $data=array();
      foreach ($request-&gt;productName  as $key =&gt; $value) {
              $data[]=[
                  'ProductName' =&gt;$value,
                  'Quantity'    =&gt;$request-&gt;Quantity[$key],
                  'price'       =&gt;$request-&gt;price[$key],
                  'OrderID'=&gt;$id
              ];          
      }
    //dd($data);
      OrderItem::where('id',$id)-&gt;update($data);
      return redirect(route('order.index',$id));
  }
  </code></pre>
  
  <p>The error appears in this line </p>
  
  <pre><code>OrderItem::where('id',$id)-&gt;update($data);
  </code></pre>
  
  <p>I tried to  </p>
  
  <ul>
  <li>use save() method but it does not work   </li>
  <li>use <code>'ProductName'    =&gt;$request-&gt;productName[$key]</code> instead of
  <code>'ProductName' =&gt;$value</code> but also does not work</li>
  </ul>
  
  <p>I want to get as this result when press update botton</p>
  
  <blockquote>
    <p>Order 1=[
             { Product 1,qty1,price 1},
             { Product 1,qty1,price 1},
            {…….}
                   ]</p>
  </blockquote>
  
  <p>Anyone can help me I will be so glade </p>