类App \ Http \ Controllers \ AuthController不存在Laravel 5.2 [英] Class App\Http\Controllers\AuthController does not exist Laravel 5.2
问题描述
我的整个应用程序(由Laravel 5.2制作)运行正常,但是当我尝试通过以下命令获取路由列表时:
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
php artisan route:list
它向我显示以下错误:
[ReflectionException]类 App \ Http \ Controllers \ AuthController不存在
[ReflectionException] Class App\Http\Controllers\AuthController does not exist
我也尝试添加名称空间:
i tried to add namespace aswell:
Route::group(['middleware' => ['web'], 'namespace' => 'Auth'], function () {
Route::auth();
});
然后显示以下错误:
[ReflectionException]
类App \ Http \ Controllers \ Auth \ Auth \ AuthController不存在
[ReflectionException]
Class App\Http\Controllers\Auth\Auth\AuthController does not exist
我的路线文件是:
Route::group(['middleware' => ['web'], 'namespace'=>'Auth'], function() {
Route::auth();
});
更新:Router.php的内容
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');
}
请帮助!谢谢
推荐答案
我无法评论,所以我要问您是否运行php artisan make:auth
,对于laravel 5.2,您不需要Routes.php
中的路线.您在href="{{ url('/login') }}"
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') }}"
这篇关于类App \ Http \ Controllers \ AuthController不存在Laravel 5.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!