mardi 12 novembre 2019

Laravel Excel: Export variant headers

I am facing the following challenge with Laravel Excel, which I consider to be the best spreadsheet out there.

So, let's each row is a user and would like to generate the headings for their hobbies as such:

name, hobby_1, hobby_2, hobby_3 Jim Smith, basketball, rowing, chess, programming

Issue is, how can I produce the headings as above provided that hobbies number may vary from user to user - that is, user John Majer may have only hobby_1 => skateboard.

For now I am just printing the headings as follows:

 public function headings(): array
    {
        return [
            'meta_id',
            'original_title',
            'total_buy_rate',
            'total_sell_rate',
            'total_margin',
            'margin',
            'eidr_id',
            'rightsline_id',
            'imdb_rating',
            'metacritic_score',
            'category'
     ];
}

Any suggestions?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire