php - Laravel:找不到导出
问题描述
我正在我的 laravel 项目中处理 Excel 导出。现在我得到了这个错误:Class 'App\Export\UsersExport' not found
我做了另外 3 个,他们工作了。这个没有,我似乎无法弄清楚是什么导致了这个错误。我正在使用“Maatwebsite 的 Laravel-Excel”。
我的出口控制器:
<?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');
}
}
用户导出:
<?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();
}
}
我不知道是什么导致了这个错误。其他的工作,但这个没有
解决方案
你有一个错字:
use App\Export\UsersExport;
use App\Exports\UsersExport;
出口
推荐阅读
- amazon-web-services - 如何找出给定 AWS 访问密钥 ID 的用户?
- paperjs - 如何在 Paper.js 中相对于父组定位项目?
- elixir - 从列表中删除多个元素
- c++ - 我可以将一个用clang c++11编译的对象与另一个用c++17编译的对象链接起来吗
- ios - 目标 C:检查 JSON 值是否是您期望的类型是否是一种好习惯?
- javascript - 在 Electron JS 应用程序中使用自定义标题栏
- java - GridLayout 内 TextView 中的文本自动调整大小
- android - “此游戏不适用于您的手机” Facebook 通知错误
- node.js - next() 在这条 Express 路由中做了什么,为什么它在代码中的顺序很重要?
- amazon-web-services - 尽管用户角色,AWS Batch 作业在 S3 上被拒绝访问