Home » Php » php – Target class does not exist – Route:List – Laravel

php – Target class does not exist – Route:List – Laravel

Posted by: admin February 25, 2020 Leave a comment

Questions:

I’m working in Laravel project and when I’m trying to see the my routes list this error appear.

Target class [App\Http\Controllers\Auth\LoginController] does not exist.

But, in fact, this controller exists, since I’m using the Laravel authentication method and in my web.php I’m calling Auth::routes().

Any ideas? Thanks in advance.

How to&Answers:

If you put your auth controller in a custom directory then you can’t use auth routes. As akbar has already pointed out, you need to remove Auth::routes() and define the routes yourself.

e.g.

Route::get('/', 'Auth\[email protected]');
Route::post('login', 'Auth\[email protected]');
Route::post('logout', 'Auth\[email protected]');

It’s either that or to put your LoginController back in the Controllers directory

Answer:

Try these solutions:

1.Define routes maually and remove Auth::routes()

2.If your laravel version is lower that 5.2 use Route::auth()instead of Auth::routes()