Level 13
use App\Export\UsersExport;
use App\Exports\UsersExport;
4 likes
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm working on the Excel exports in my laravel project. Now I get this error:Class 'App\Export\UsersExport' not found I made 3 others and they worked. This one doesn't and I can't seem to figure out what causes this error. I'm using "Maatwebsite's Laravel-Excel".
My exports controller:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
//exports
use App\Export\UsersExport;
use App\Exports\StudyClassExport;
use App\Exports\EducationsExport;
use App\Exports\IntakesExport;
use Maatwebsite\Excel\Facades\Excel;
use App\Http\Controllers\Controller;
class ExportsController extends Controller
{
public function users()
{
return Excel::download(new UsersExport, 'gebruikers.xlsx');
}
public function educations()
{
return Excel::download(new EducationsExport, 'opleidingen.xlsx');
}
public function classes()
{
return Excel::download(new StudyClassExport, 'klassen.xlsx');
}
public function intakes()
{
return Excel::download(new IntakesExport, 'intakes.xlsx');
}
}
UsersExport:
<?php
namespace App\Exports;
use App\User;
use Maatwebsite\Excel\Concerns\FromCollection;
class UsersExport implements FromCollection
{
/**
* @return \Illuminate\Support\Collection
*/
public function collection()
{
return User::all();
}
}
I have no idea what causes this error. The others work but this one doesn't
Please or to participate in this conversation.