Class App\Http\Controllers\UserController Does Not Exist

后端 未结 6 2582
忘掉有多难
忘掉有多难 2020-12-11 04:04

Having the issue when loading the route /users or /user/add and being return an error of;

ReflectionException in Route.php line 280: Class App\\Http

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-11 04:17

    Laravel 8.x update has a different way of using routes.

    Previously it was:

    Route::get('/', 'PagesController@index');
    

    Now it has changed to

    Route::get('/',[PagesController::class, 'index']);
    

    Note: don't forget to import (use) your controller in the routes(web.php) file at the top. Like:

    use App\Http\Controllers\PagesController;
    

提交回复
热议问题