phpexceluserfrosting

Using maatwebsite excel with userfrosting


I am trying to do an export of custom data which gets fed into DataTables in userfrosting. I have loaded the maatwebsite excel library using composer and the autoload_classmap.php was updated. In the controller I tried using the following:

Excel::create('master',function($excel) use($events){                    
    $excel->sheet('Master List', function($sheet) use($events){          
        $sheet->fromArray($events);                                      
    });                                                                  
})->export('xls'); 

When I run this, I get the following error:

PHP Fatal error:  Class 'UserFrosting\Excel' not found in /usr/www

I have looked at the laravel examples and tried them and they work with no problems. But I need this to work on userfrosting as the application is already and only missing the export.


Solution

  • I ended up leaving maatwebsite/excel for phpoffice/phpexcel which worked a bit quicker for me, I will attempt to get an answer to this question in the near future.