title: Export data to Excel in Laravel
body: <p>I want to make export data into excel in my project, i have made it, but after I check the results, the results  doesnt like what I want. here I would like to make a result there is a title table.</p>
  <p>This code my controller:</p>
  
  
  <pre><code>public function getExport(){
          Excel::create('Export data', function($excel) {
  
          $excel-&gt;sheet('Sheet 1', function($sheet) {
  
              $products=DB::table('log_patrols')
              -&gt;join(&quot;cms_companies&quot;,&quot;cms_companies.id&quot;,&quot;=&quot;,&quot;log_patrols.id_cms_companies&quot;)
              -&gt;join(&quot;securities&quot;,&quot;securities.id&quot;,&quot;=&quot;,&quot;log_patrols.id_securities&quot;)
              -&gt;select(&quot;log_patrols.*&quot;,&quot;cms_companies.name as nama_companies&quot;,&quot;securities.name as nama_security&quot;)
              -&gt;get();
                  foreach($products as $product) {
                   $data[] = array(
                      $product-&gt;date_start,
                      $product-&gt;date_end,
                      $product-&gt;condition_status,
                      $product-&gt;nama_security,
                      $product-&gt;nama_companies,
                  );
              }
              $sheet-&gt;fromArray($data);
          });
      })-&gt;export('xls');
      }
  </code></pre>
  
  <p>this my problem result :
  <a href="https://i.stack.imgur.com/nSeBj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nSeBj.png" alt="result" /></a></p>
  <p>and it should be :</p>
  <p><a href="https://i.stack.imgur.com/tPyBj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tPyBj.png" alt="should" /></a></p>
  <p>my problem is how to change the number into text what i want in the header table.</p>
  <p>what improvements do i have to make to the code to achieve my goal?</p>
  <p><strong>NB</strong> : i use maatwebsite/excel</p>