Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class 'App\Http\Controllers\Excel' not found in Laravel

In my controller I have the code as below:

Excel::create('Laravel Excel', function($excel) {

        $excel->sheet('Excel sheet', function($sheet) {

            $sheet->setOrientation('landscape');

        });

    })->export('xls');

In config/app.php in aliases array i have defined this:

'Excel'     => 'Maatwebsite\Excel\ExcelServiceProvider',

I dont know why i cant make it work this library... Any idea?

like image 778
Lulzim Avatar asked May 10 '15 18:05

Lulzim


1 Answers

After all this you need to check whether or not you have this at the top:

use Maatwebsite\Excel\Facades\Excel;
like image 85
Mohammad Sheykholeslam Avatar answered Sep 18 '22 14:09

Mohammad Sheykholeslam