Class App\Http\Controllers\AuthController does not exist Laravel 5.2
24,254
Solution 1
I cannot comment so I'm going to ask have you run php artisan make:auth
and with laravel 5.2 you dont need your routes in your Routes.php
. All you have to have in your href="{{ url('/login') }}"
Solution 2
in my case just remove:
'namespace' => 'App\Http\Controllers',
Author by
Awn Ali
Updated on July 09, 2022Comments
-
Awn Ali almost 2 years
My whole application, made in Laravel 5.2, is working perfectly fine but when i tried to get list of routes through following command:
php artisan route:list
It shows me following error:
[ReflectionException] Class App\Http\Controllers\AuthController does not exist
i tried to add namespace aswell:
Route::group(['middleware' => ['web'], 'namespace' => 'Auth'], function () { Route::auth(); });
then it shows me following error:
[ReflectionException]
Class App\Http\Controllers\Auth\Auth\AuthController does not existMy routes file is:
Route::group(['middleware' => ['web'], 'namespace'=>'Auth'], function() { Route::auth(); });
Update: content of Router.php
public function auth() { // Authentication Routes... $this->get('login', 'Auth\AuthController@showLoginForm'); $this->post('login', 'Auth\AuthController@login'); $this->get('logout', 'Auth\AuthController@logout'); // Registration Routes... $this->get('register', 'Auth\AuthController@showRegistrationForm'); $this->post('register', 'Auth\AuthController@register'); // Password Reset Routes... $this->get('password/reset/{token?}', 'Auth\PasswordController@showResetForm'); $this->post('password/email', 'Auth\PasswordController@sendResetLinkEmail'); $this->post('password/reset', 'Auth\PasswordController@reset'); }
Please help! Thanks
-
Md Rashedul Hoque Bhuiyan about 8 yearsremove 'namespace'=>'Auth', working ?
-
Alireza Rahmani khalili about 8 yearsdid you run the composer dump-autoload command?
-
Alex Quintero almost 8 yearsThe dump-autoload command updates information autoloader. This command is useful when you add new classes and do not want to run the install or update command
-
-
Subtlebot almost 3 yearsYou only want one namespace declaration. This looks like the second declaration was overriding the first, until you switched them around. You only need one.
-
Admin over 2 yearsAs it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.