title: How to fix "Call to a member function get() on array" : Laravel 5.4
body: <p>I have a trouble downloading files that I've generated data, from database using <strong>maatwebsite/laravel-excel</strong>. Error : Call to a member function get() on array.</p>
  
  <p>Before, when I selected data from the database using only one field, the file can generate(.csv). But when I try to query using aliases "as" the data cannot be obtained.</p>
  
  <pre><code>public function getdoc($type)
  {
      -- with this query : success --
      //$temp = AlarmV2::select('msisdn')-&gt;get();
      $today = "20181008";
      -- with this query : error --
      $temp = DB::select(DB::raw("select regionalid,
      nvl(sum(case when lastactiontype='0' then totalcharge end),0) as creditlimit_usage, 
      count(case when lastactiontype='0' then msisdn end) as creditlimit_rec,
      from alarms_v2
      where alarmdate = '$today'
      -- fatal error exception :Call to a member function get() on array --
      group by regionalid order by regionalid"))-&gt;get();
  
      return Excel::create('datadoc', function ($excel) use ($temp) {
          $excel-&gt;sheet('mySheet', function ($sheet) use ($temp) {
              $sheet-&gt;fromArray($temp);
          });
      })-&gt;download($type);
  }
  </code></pre>