Class App \ Http \ Controllers \ Auth \ LoginController does not exist in laravel 5.3

I created several auth in Laravel 5.3,

Then moved Controller/Auth/[files]to:

Admin: Controller/Admin/Auth/[files]and

Site: Controller/Site/Auth/[files]

At the command prompt, type php artisan route:list,

He shows me the following error:

Class App \ Http \ Controllers \ Auth \ LoginController does not exist

Where is my problem?

+4
source share
4 answers

You need to manually identify all routes Authin web.phpand delete Auth::routes().

just define all your routes, for example

Route::group(['namespace' => 'Admin', 'prefix' => 'admin'], function () {
    Route::get('/', 'Auth\LoginController@showLoginForm');
    Route::post('login', 'Auth\LoginController@login');
    Route::post('logout', 'Auth\LoginController@logout');
});

Route::group(['namespace' => 'Site', 'prefix' => 'admin'], function () {
    Route::get('/', 'Auth\LoginController@showLoginForm');
    Route::post('login', 'Auth\LoginController@login');
    Route::post('logout', 'Auth\LoginController@logout');
});
+2
source

, auth-. :

5.2

Route::auth();

5.3

Auth::routes();

auth- .

+1

, /web.php

/* For get login page*/
    Route::get('/login', function () {return view('auth.login');});

 /* while post remember to user Auth\controllername so you can get the perfect path for the custom login  */
    Route::post('/login', 'Auth\LoginController@authentication')->name('login');
0

, , . - GitHub .

https://github.com/laravel/laravel/tree/5.3/app/Http/Controllers/Auth

You must also ensure that you call the Auth :: routes () method in the routes / web.php file. This method will register the correct routes for new authentication controllers.

Paste this answer from the Laravel update documentation.

0
source

Source: https://habr.com/ru/post/1667280/


All Articles