我正在尝试创建一个重置密码URI,它就在那里并使用Laravel内置的重置密码系统,但当我测试它时,我得到:
EloquentUserProvider.php第126行中的FatalErrorException:Class '\ App \ User'未找到
这是我的config / auth.php:
form = MaterialForm
这是我的app / Http / routes.php:
/*
|--------------------------------------------------------------------------
| Authentication Model
|--------------------------------------------------------------------------
|
| When using the "Eloquent" authentication driver, we need to know which
| Eloquent model should be used to retrieve your users. Of course, it
| is often just the "User" model but you may use whatever you like.
|
*/
'model' => App\User::class,
我的用户类位于app / User.php:
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::post('register', 'RegisterController@register');
Route::post('resetpassword', 'Auth\PasswordController@postEmail');
Route::resource('api/authenticate', 'AuthenticateController', ['only' => ['index']]);
Route::post('api/authenticate', 'AuthenticateController@authenticate');
//All protected routes should go in this group
Route::group(['middleware' => 'isUserAuthed'], function () {
Route::get('restricted', 'WelcomeController@welcome');
});
有人能指出我正确的方向吗?我的文档似乎不太清楚。
答案 0 :(得分:1)
您的文件名应为User.php
而不是user.php
答案 1 :(得分:0)
\ App \ User
您是否尝试在应用程序文件夹中运行此命令?
composer dump-autoload
答案 2 :(得分:0)
尝试删除::class
'model' => 'App\User',
答案 3 :(得分:-2)
我认为这可能是因为User模型的命名空间或项目命名空间存在问题。
检查一下:
"psr-4": {
"App\\": "app/"
....
检查它是否与App不同(必须与区分大小写匹配)。希望它有所帮助。
让我邀请您参加Learn Laravel课程,我确定您会发现它对您的项目非常有用。
祝福。