title: Indirect modification of overloaded element has no effect
body: <p>I have the following Eloquent query:</p>
  
  <pre><code>$item = Item::where('sku', $sku)-&gt;first();
  </code></pre>
  
  <p>After this query comes in I'm adding a variety of elements manually such as:</p>
  
  <pre><code>$item['total'] = $item['subtotal'] + $this-&gt;currentInventory();
  </code></pre>
  
  <p>Statements like the above that modify the object work just fine.</p>
  
  <p>It stops working when I do the following:</p>
  
  <pre><code>$item['fields'] = [];
  
  $fields = DB::table('item_fields')-&gt;where('item_id', $item['id'])-&gt;get();
  
  foreach ($fields as $f) {
      if (!isset($item['fields'][$f-&gt;field_group_name]))
           $item['fields'][$f-&gt;field_group_name] = [];
  
      $item['fields'][$f-&gt;field_group_name]['valid_values'] = DB::table('item_field_valid_values')-&gt;where('item_field_id', $f-&gt;item_field_id);
  }
  </code></pre>
  
  <p>This will cause the line <code>$item['fields'][$f-&gt;field_group_name] = [];</code> to produce the error:</p>
  
  <pre><code>Indirect modification of overloaded element of Item has no effect
  </code></pre>
  
  <p>How can it be that I can assign <code>$item['fields'] = []</code> but when I try to add an actual element to the <code>$item['fields']</code> array that I get this error?</p>
  
  <p>PHP version 5.6.0.</p>