Hi,
I use this package and it works perfectly.
It seems like you are trying to use the facade: https://docs.laravel-excel.com/3.1/architecture/#facade but that still requires you to call an exporter class that you need to create:
Try to follow this quick start guide: https://docs.laravel-excel.com/3.1/exports/
Create an export class in app/Exports You may do this by using the make:export command.
php artisan make:export UsersExport --model=User
The file can be found in app/Exports:
.
├── app
│ ├── Exports
│ │ ├── UsersExport.php
│
└── composer.json
If you prefer to create the export manually, you can create the following in app/Exports:
<?php
namespace App\Exports;
use App\User;
use Maatwebsite\Excel\Concerns\FromCollection;
class UsersExport implements FromCollection
{
public function collection()
{
return User::all();
}
}
In your controller you can call this export now:
use App\Exports\UsersExport;
use Maatwebsite\Excel\Facades\Excel;
use App\Http\Controllers\Controller;
class UsersController extends Controller
{
public function export()
{
return Excel::download(new UsersExport, 'users.xlsx');
}
}
Find your users.xlsx in your downloads folder!
Hope it will help you!