title: Query result into array in Laravel 6
body: <p>I have this result from my database:</p>
  
  <pre><code>year  column1  column2
  2018    11         7
  2019    24        12
  2020    15        13
  </code></pre>
  
  <p>I want put the result in arrays like this:</p>
  
  <pre><code>['2018','2019','2020']
  [11, 24, 15 ]
  [7, 12, 13]
  </code></pre>
  
  <p>I need make a stacked bar graph, i'm using charts.js:</p>
  
  <pre><code>$chart01 = new BarChart;
  $chart01 -&gt;type('bar')
           -&gt;labels(['2018','2019','2020']);
  
  $chart01-&gt;dataset('Column1', 'bar', [11,24,15])
                      -&gt;options(['backgroundColor' =&gt; ['#58D3F7','#58D3F7','#58D3F7']]);
  
  $chart01-&gt;dataset('Column2', 'bar', [7,12,13])
                      -&gt;options(['backgroundColor' =&gt; ['#5882FA','#5882FA','#5882FA']]);
  
  $options = [];
  $options['scales'] = [ 'xAxes' =&gt; [ ['stacked' =&gt; true] ], 'yAxes' =&gt; [ ['stacked' =&gt; true] ] ];
  $chart01-&gt;options($options);
  </code></pre>
  
  <p>Any idea? thanks!</p>