title: how to remove a parent index array and change it to object in laravel
body: <p>I have an array like below :</p>
  <pre><code>array:3 [
    &quot;2021-08-07&quot; =&gt; array:3 [
      &quot;id&quot; =&gt; &quot;1&quot;
      &quot;date&quot; =&gt; &quot;2021-08-07&quot;
      &quot;numbers&quot; =&gt; array:2 [
        0 =&gt; 1
        1 =&gt; 2
      ]
    ]
    &quot;2021-08-08&quot; =&gt; array:3 [
      &quot;id&quot; =&gt; &quot;1&quot;
      &quot;date&quot; =&gt; &quot;2021-08-08&quot;
      &quot;numbers&quot; =&gt; array:2 [
        0 =&gt; 1
        1 =&gt; 2
      ]
    ]
  ]
  </code></pre>
  <p>What I want to do is simply to remote the parent <code>2021-08-08</code> items because I have the date inside the array already . Now, what I have tried so far is :</p>
  <pre><code>$result = array_map(function ($el){
      return $el[0];
  },$test);
  
  dd($result);
  </code></pre>
  <p>But it gives me error of <code>undefined index[0]</code> . what I want this array to look like is like below :</p>
  <pre><code>array:3 [
      &quot;id&quot; =&gt; &quot;1&quot;
      &quot;date&quot; =&gt; &quot;2021-08-07&quot;
      &quot;numbers&quot; =&gt; array:2 [
        0 =&gt; 1
        1 =&gt; 2
    ],
      &quot;id&quot; =&gt; &quot;1&quot;
      &quot;date&quot; =&gt; &quot;2021-08-08&quot;
      &quot;numbers&quot; =&gt; array:2 [
        0 =&gt; 1
        1 =&gt; 2
    ]
  ]
  </code></pre>