title: Laravel Excel , exporting from a model, styling issues
body: <p>I am trying to export some data from my model to excel scheet with "Laravel excel", I have done it, but my result is far away from what I really need<br><br>
  <strong><em>That is what I`ve got in downloaded file:</em></strong>
  <img src="https://i.stack.imgur.com/BaObi.png" alt="actual laravel excel export"> </p>
  
  <p><strong><em>And that is what i really want to accomplish:</em></strong>
  <img src="https://i.stack.imgur.com/5QKdF.png" alt="export goal"></p>
  
  <p><strong>My controller part:</strong></p>
  
  <pre><code>//casting export...
          Excel::create('ExcelExport', function($excel) use($filters, $agents) {
  
              $main_arr = array();
  
              foreach($agents as $value){                 
                  $main_arr[] = Card::cardForUser($value, $filters)-&gt;toArray();                   
              }
  
              $excel-&gt;sheet('Sheetshit', function($sheet) use($main_arr) {
                  //You may ask me "why are you using foreach?"
                  // and my answer will be:"I don`t KNOW, because it WORKS!"
  
                  foreach($main_arr as $one){
                      $sheet-&gt;fromArray($one);
                  }
  
              });
  
          })-&gt;export('xls');
  </code></pre>
  
  <p><strong>Model part:</strong></p>
  
  <pre><code>public static  function  cardForUser($user_id, $filters = array()){
          $query = static::UserId($user_id);//just gets 'where user id'
  
          foreach($filters['fields'] as $select){
              $query-&gt;addSelect($select);
          }
              return $query-&gt;get();
      }    
  
      public function scopeUserId($query, $user_id) {
          return $query-&gt;where('user_id', '=', $user_id);
  
      }
  </code></pre>
  
  <p><em><code>$filters</code> array consist of fields names from DB, so it basically decides which columns include in export. That means that my <code>$main_arr</code> may have length of inner fields from 1 to 5. Every agent can have a lot of rows in DB or none at all</em> </p>
  
  <p><strong>Example of $main_arr dump with 4 filters set:</strong> </p>
  
  <pre><code> array (size=8)
    0 =&gt; 
      array (size=10)
  
  //thats will be first agent
            0 =&gt; 
              array (size=4)
                'date_start' =&gt; string '06.08.2014 10:00:00' (length=19)
                'ts_category' =&gt; int 2
                'ts_make' =&gt; string 'Chrysler' (length=8)
                'ts_model' =&gt; string 'PT CRUISER' (length=10)
            1 =&gt; 
              array (size=4)
                'date_start' =&gt; string '06.08.2014 10:00:00' (length=19)
                'ts_category' =&gt; int 2
                'ts_make' =&gt; string 'Opel' (length=4)
                'ts_model' =&gt; string 'Corsa' (length=5)
            2 =&gt; 
              array (size=4)
                'date_start' =&gt; string '06.08.2014 10:00:00' (length=19)
                'ts_category' =&gt; int 2
                'ts_make' =&gt; string 'Dodge' (length=5)
                'ts_model' =&gt; string 'Stratus' (length=7)
            3 =&gt; 
              array (size=4)
                'date_start' =&gt; string '06.08.2014 10:00:00' (length=19)
                'ts_category' =&gt; int 2
                'ts_make' =&gt; string 'Р’РђР—' (length=6)
                'ts_model' =&gt; string '2112' (length=4)
            4 =&gt; 
              array (size=4)
                'date_start' =&gt; string '06.08.2014 10:00:00' (length=19)
                'ts_category' =&gt; int 2
                'ts_make' =&gt; string 'Mercedes-Benz' (length=13)
                'ts_model' =&gt; string 'E 270' (length=5)
            5 =&gt; 
              array (size=4)
                'date_start' =&gt; string '06.08.2014 10:00:00' (length=19)
                'ts_category' =&gt; int 2
                'ts_make' =&gt; string 'Р’РђР—' (length=6)
                'ts_model' =&gt; string '21140 LADA SAMARA' (length=17)
            6 =&gt; 
              array (size=4)
                'date_start' =&gt; string '06.08.2014 10:00:00' (length=19)
                'ts_category' =&gt; int 2
                'ts_make' =&gt; string 'LADA' (length=4)
                'ts_model' =&gt; string '213100 LADA 4С…4' (length=16)
            7 =&gt; 
              array (size=4)
                'date_start' =&gt; string '06.08.2014 10:00:00' (length=19)
                'ts_category' =&gt; int 2
                'ts_make' =&gt; string 'Р’РђР—' (length=6)
                'ts_model' =&gt; string '21110' (length=5)
            8 =&gt; 
              array (size=4)
                'date_start' =&gt; string '06.08.2014 10:00:00' (length=19)
                'ts_category' =&gt; int 2
                'ts_make' =&gt; string 'Chevrolet' (length=9)
                'ts_model' =&gt; string 'Lanos' (length=5)
            9 =&gt; 
              array (size=4)
                'date_start' =&gt; string '06.08.2014 10:00:00' (length=19)
                'ts_category' =&gt; int 2
                'ts_make' =&gt; string 'VOLKSWAGEN' (length=10)
                'ts_model' =&gt; string 'PASSAT' (length=6)
  //thats will be second agent
        1 =&gt; 
          array (size=10)
            0 =&gt; 
              array (size=4)
                'date_start' =&gt; string '06.08.2014 10:00:00' (length=19)
                'ts_category' =&gt; int 2
                'ts_make' =&gt; string 'Mercedes' (length=8)
                'ts_model' =&gt; string 'Benz' (length=4)
            1 =&gt; 
              array (size=4)
                'date_start' =&gt; string '06.08.2014 10:00:00' (length=19)
                'ts_category' =&gt; int 2
                'ts_make' =&gt; string 'Chevrolet' (length=9)
                'ts_model' =&gt; string 'Corvette' (length=8)
            2 =&gt; 
              array (size=4)
                'date_start' =&gt; string '06.08.2014 10:00:00' (length=19)
                'ts_category' =&gt; int 2
                'ts_make' =&gt; string 'Chevrolet' (length=9)
                'ts_model' =&gt; string 'Corvette' (length=8)
            3 =&gt; 
              array (size=4)
                'date_start' =&gt; string '06.08.2014 10:00:00' (length=19)
                'ts_category' =&gt; int 2
                'ts_make' =&gt; string 'Chevrolet' (length=9)
                'ts_model' =&gt; string 'Corvette' (length=8)
            4 =&gt; 
              array (size=4)
                'date_start' =&gt; string '06.08.2014 10:00:00' (length=19)
                'ts_category' =&gt; int 2
                'ts_make' =&gt; string 'Chevrolet' (length=9)
                'ts_model' =&gt; string 'Corvette' (length=8)
            5 =&gt; 
              array (size=4)
                'date_start' =&gt; string '06.08.2014 10:00:00' (length=19)
                'ts_category' =&gt; int 2
                'ts_make' =&gt; string 'Chevrolet' (length=9)
                'ts_model' =&gt; string 'Corvette' (length=8)
            6 =&gt; 
              array (size=4)
                'date_start' =&gt; string '06.08.2014 10:00:00' (length=19)
                'ts_category' =&gt; int 2
                'ts_make' =&gt; string 'Mazeratti' (length=9)
                'ts_model' =&gt; string 'M4' (length=2)
            7 =&gt; 
              array (size=4)
                'date_start' =&gt; string '06.08.2014 10:00:00' (length=19)
                'ts_category' =&gt; int 2
                'ts_make' =&gt; string 'Ferrari' (length=7)
                'ts_model' =&gt; string 'F4' (length=2)
            8 =&gt; 
              array (size=4)
                'date_start' =&gt; string '06.08.2014 10:00:00' (length=19)
                'ts_category' =&gt; int 2
                'ts_make' =&gt; string 'Mazda' (length=5)
                'ts_model' =&gt; string '5' (length=1)
            9 =&gt; 
              array (size=4)
                'date_start' =&gt; string '06.08.2014 10:00:00' (length=19)
                'ts_category' =&gt; int 2
                'ts_make' =&gt; string 'Test' (length=4)
                'ts_model' =&gt; string 'Test' (length=4)
          etc...
  </code></pre>
  
  <p><strong>Sooo... my questions are</strong>:</p>
  
  <ol>
  <li>How do I set main title ("Header stuff" in example img)?</li>
  <li>why do I have my columns headers(date_start, ts_category,ts_make,ts_model) disappear in first array element? (You can see at the first img that I don't have "date start" and "ts_category" headers for first sub-array. BTW sometimes I don`t have headers at all for first sub-array!)</li>
  <li>Can I make my sub-array's headers bold(ts_make, etc)? How?</li>
  <li>How can I make sub-titles for every agent(I planning to use sub-array key to display a number of agent)?</li>
  </ol>
  
  <hr>
  
  <p><strong>UPDATE</strong> Posted working code as answer.</p>