I 5 minute quick start guide for Laravel-Excel https://docs.laravel-excel.com/3.1/exports/ but it returns a blank page instead of the Excel file. My code looks almost identical to the site. I'm running PHP 8.2, Laravel 11.5, and Laravel-Excel 3.1
EntriesExport
<?php
namespace App\Exports;
use App\Models\Entry;
use Maatwebsite\Excel\Concerns\FromCollection;
class EntriesExport implements FromCollection
{
/**
* @return \Illuminate\Support\Collection
*/
public function collection()
{
return Entry::all();
}
}
In my controller:
public function export()
{
return Excel::download(new EntriesExport, 'entries.xlsx');
}
In my routes:
Route::get('/entries/export/', [EntriesController::class, 'export'])->name('excel');