How to get value from all index of collection in laravel Illuminate?
<p>I have to query data from DB to using Illuminate in laravel then I want to get all the attribute value from all index of this array.</p>

<pre><code>array:36 [▼
  0 =&gt; RepaymentSchedule {#553 ▶}
  1 =&gt; RepaymentSchedule {#554 ▶}
  2 =&gt; RepaymentSchedule {#555 ▶}
  3 =&gt; RepaymentSchedule {#556 ▶}
  4 =&gt; RepaymentSchedule {#557 ▶}
  5 =&gt; RepaymentSchedule {#558 ▶}
  6 =&gt; RepaymentSchedule {#559 ▶}
  7 =&gt; RepaymentSchedule {#560 ▶}
  8 =&gt; RepaymentSchedule {#561 ▶}
  9 =&gt; RepaymentSchedule {#562 ▶}
  10 =&gt; RepaymentSchedule {#563 ▶}
  11 =&gt; RepaymentSchedule {#564 ▶}
  12 =&gt; RepaymentSchedule {#565 ▶}
  13 =&gt; RepaymentSchedule {#566 ▶}
  14 =&gt; RepaymentSchedule {#567 ▶}
  15 =&gt; RepaymentSchedule {#568 ▶}
  16 =&gt; RepaymentSchedule {#569 ▶}
  17 =&gt; RepaymentSchedule {#570 ▶}
  18 =&gt; RepaymentSchedule {#571 ▶}
  19 =&gt; RepaymentSchedule {#572 ▶}
  20 =&gt; RepaymentSchedule {#573 ▶}
  21 =&gt; RepaymentSchedule {#574 ▶}
  22 =&gt; RepaymentSchedule {#575 ▶}
  23 =&gt; RepaymentSchedule {#576 ▶}
  24 =&gt; RepaymentSchedule {#577 ▶}
  25 =&gt; RepaymentSchedule {#578 ▶}
  26 =&gt; RepaymentSchedule {#579 ▶}
  27 =&gt; RepaymentSchedule {#580 ▶}
  28 =&gt; RepaymentSchedule {#581 ▶}
  29 =&gt; RepaymentSchedule {#582 ▶}
  30 =&gt; RepaymentSchedule {#583 ▶}
  31 =&gt; RepaymentSchedule {#584 ▶}
  32 =&gt; RepaymentSchedule {#585 ▶}
  33 =&gt; RepaymentSchedule {#586 ▶}
  34 =&gt; RepaymentSchedule {#587 ▶}
  35 =&gt; RepaymentSchedule {#588 ▶}
]
</code></pre>

<p>I have try to used bellow </p>

<pre><code>$collapsed = $loan-&gt;schedule-&gt;all();
  dd($collapsed);

  $collection = $collapsed-&gt;each(function ($item, $key) {
    dd($key);
  });
</code></pre>