当前位置: 动力学知识库 > 问答 > 编程问答 >

php - Class 'User' not found laravel 5.2 right after fresh installation

问题描述:

I have just installed fresh laravel 5.2 application following the guide in the documentation - https://laravel.com/docs/5.2#installing-laravel.

It's not first time I did that, but I didn't have such a problem before.

I am getting this error:

FatalThrowableError in routes.php line 15:

Fatal error: Class 'User' not found

I my routes.php I have only:

Route::get('/', function () {

return view('welcome'); });

I can't understand where the problem can be. I have this error on fresh installation, never faced with such problem before. Any help would be appreciated.

Here is a full screenshot with error:

Screenshot with error

List of errors:

FatalThrowableError in routes.php line 15:

Fatal error: Class 'User' not found

in routes.php line 15

at RouteServiceProvider->{closure}()

at call_user_func_array(object(Closure), array()) in Route.php line 158

at Route->runCallable(object(Request)) in Route.php line 137

at Route->run(object(Request)) in Router.php line 724

at Router->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))

at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102

at Pipeline->then(object(Closure)) in Router.php line 726

at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 699

at Router->dispatchToRoute(object(Request)) in Router.php line 675

at Router->dispatch(object(Request)) in Kernel.php line 246

at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))

at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52

at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44

at CheckForMaintenanceMode->handle(object(Request), object(Closure))

at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124

at Pipeline->Illuminate\Pipeline\{closure}(object(Request))

at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32

at Pipeline->Illuminate\Routing\{closure}(object(Request))

at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102

at Pipeline->then(object(Closure)) in Kernel.php line 132

at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99

at Kernel->handle(object(Request)) in index.php line 53

Full routes.php file:

<?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::get('/', function () {

return view('welcome');

});

网友答案:
php artisan clear-compiled  
php artisan optmize

That helped me! Thanks to everybody!

分享给朋友:
您可能感兴趣的文章:
随机阅读: