Rumah  >  Artikel  >  pembangunan bahagian belakang  >  Laravel 5.2 Model 目录问题

Laravel 5.2 Model 目录问题

WBOY
WBOYasal
2016-10-11 14:23:411111semak imbas

laravel5.2 之前是User.php在App下,之后自己创建Model\User.php,即将User.php模型放到Model目录下,导致自带的Login , Auth 验证的时候出现,App\User not found,不知道在哪里修改,求帮助,如下报错信息。:)

<code>FatalThrowableError in EloquentUserProvider.php line 130:
Class '\App\User' not found
in EloquentUserProvider.php line 130
at EloquentUserProvider->createModel() in EloquentUserProvider.php line 96
at EloquentUserProvider->retrieveByCredentials(array('email' => 'Admin@ssd.com', 'password' => '081500943')) in SessionGuard.php line 353
at SessionGuard->attempt(array('email' => 'Admin@ssd.com', 'password' => '081500943'), false) in /export/usr/www/httpd2/htdocs/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php line 74
at AuthController->login(object(Request))
at call_user_func_array(array(object(AuthController), 'login'), array(object(Request))) in Controller.php line 80
at Controller->callAction('login', array(object(Request))) in ControllerDispatcher.php line 146
at ControllerDispatcher->call(object(AuthController), object(Route), 'login') in ControllerDispatcher.php line 94
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in RedirectIfAuthenticated.php line 24
at RedirectIfAuthenticated->handle(object(Request), object(Closure))
at call_user_func_array(array(object(RedirectIfAuthenticated), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
</code>

回复内容:

laravel5.2 之前是User.php在App下,之后自己创建Model\User.php,即将User.php模型放到Model目录下,导致自带的Login , Auth 验证的时候出现,App\User not found,不知道在哪里修改,求帮助,如下报错信息。:)

<code>FatalThrowableError in EloquentUserProvider.php line 130:
Class '\App\User' not found
in EloquentUserProvider.php line 130
at EloquentUserProvider->createModel() in EloquentUserProvider.php line 96
at EloquentUserProvider->retrieveByCredentials(array('email' => 'Admin@ssd.com', 'password' => '081500943')) in SessionGuard.php line 353
at SessionGuard->attempt(array('email' => 'Admin@ssd.com', 'password' => '081500943'), false) in /export/usr/www/httpd2/htdocs/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php line 74
at AuthController->login(object(Request))
at call_user_func_array(array(object(AuthController), 'login'), array(object(Request))) in Controller.php line 80
at Controller->callAction('login', array(object(Request))) in ControllerDispatcher.php line 146
at ControllerDispatcher->call(object(AuthController), object(Route), 'login') in ControllerDispatcher.php line 94
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in RedirectIfAuthenticated.php line 24
at RedirectIfAuthenticated->handle(object(Request), object(Closure))
at call_user_func_array(array(object(RedirectIfAuthenticated), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
</code>

check your config/auth.php file and update the following:

<code>'providers' => [
    'users' => [
        'driver' => 'eloquent',
        'model' => App\User::class, //</code>
Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn