Home > Software design >  Laravel8 Target class [App\Http\Controllers\LoginController] does not exist
Laravel8 Target class [App\Http\Controllers\LoginController] does not exist

Time:09-01

When I went to check for all routes in the command line using php artisan route:list then this error happens though LoginController is placed on Auth directory.

CodePudding user response:

Issue is regarding your web.php or api.php route files. You referenced LoginController class in route files but you either didn't import it as use App\Http\Controllers\LoginController; or your namespace is incorrect. Make sure your namespace is correct and import the class properly to tackle the problem.

CodePudding user response:

So here is the solution to resolve this error. Remember that if your LoginController is in Auth directory, then you can follow this solution.

  1. composer dump-autoload
  2. php artisan optimize:clear
  3. php artisan config:cache
  4. php artisan cache:clear

Then run php artisan route:list again. I hope the error has resolved now and your route list has been shown properly.

  • Related