Laravel 6.0 php artisan route:list returns “Target class [App\Http\Controllers\SessionsController] does not exist.”

后端 未结 17 1815
無奈伤痛
無奈伤痛 2021-02-05 10:36

I am using Laravel 6.0 and I try to list all my routes with artisan route:list, but it fails and returns:

Illuminate\\Contracts\\Container\\

17条回答
  •  鱼传尺愫
    2021-02-05 11:24

    This is the perfect answer, I think:

    • Option 1:
    use App\Http\Controllers\HomepageController;
    Route::get('/', [HomepageController::class, 'index']);
    
    • Option 2:
    Route::get('/', 'App\Http\Controllers\HomepageController@index');
    

提交回复
热议问题