Class App\Http\Controllers\UserController Does Not Exist

后端 未结 6 2583
忘掉有多难
忘掉有多难 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:29

    use App\Http\Controllers\UserController;

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

    Laravel 8 has updated the route format. above route will only only for laravel 8 or higher

    if you laravel below 8 try using

    Route::get('/user', 'UserController@index');

提交回复
热议问题