title: Using foreach on array in Laravel view
body: <p>Why is my foreach loop fails with error "Trying to get property of non-object":</p>
  
  <pre><code>@foreach ($memberships as $membership)
      {{ $membership-&gt;id }}
  @endforeach 
  </code></pre>
  
  <p>but this works just fine:</p>
  
  <pre><code>@foreach ($memberships as $membership)
      &lt;?php print_r($membership['id']); ?&gt;
  @endforeach 
  </code></pre>
  
  <p>if I <code>dd($memberships);</code> I get</p>
  
  <pre><code>array:2 [▼
    0 =&gt; array:1 [▼
      "id" =&gt; 8
    ]
    1 =&gt; array:1 [▼
      "id" =&gt; 9
    ]
  ]
  </code></pre>