Answer the question
In order to leave comments, you need to log in
Why doesn't Laravel load the maatwebsite/excel class?
It is necessary to implement export to Excel.
I use: laravel + maatwebsite/excel package, I work on ubunt'e.
I'm trying to do an elementary export:
<?php
namespace App\Http\Controllers;
use App\Http\Requests;
use Maatwebsite\Excel\Facades\Excel as Excel;
class Statistic extends Controller
{
public function export()
{
Excel::create('Laravel_Excel', function($excel) {
$excel->sheet('Excel_sheet', function($sheet) {
$sheet->setOrientation('landscape');
});
})->export('xls');
}
}
Answer the question
In order to leave comments, you need to log in
And if you try directly, through:
app()->make('Maatwebsite\Excel\Excel') or app()->make('excel')?
use Maatwebsite\Excel\Facades\Excel as Excel; // ?
It also works with Excel (that is, without `as Excel`).
If it were for example like this:
It would make sense to shorten `SomeLongerExcelPackageName` to `Excel`. I.e:
Well that's a note ;)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question