2017-01-19 5 views
4

に存在していない私はLaravel 5.3でマルチ認証を作成し、\、クラスのApp のHttp コントローラが認証 LoginControllerがlaravel 5.3

その後にController/Auth/[files]を移動:

管理者:Controller/Admin/Auth/[files] &

サイト:私はphp artisan route:listを入力し、コマンドラインでController/Site/Auth/[files]

次のエラーが表示されます:

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

どこに問題がありますか?

答えて

2

すべてのAuthルートをweb.phpに手動で定義し、Auth::routes()を削除する必要があります。

だけでは、カスタムディレクトリにコントローラを移動している場合は、認証ルートを使用しないでください

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

Route::group(['namespace' => 'Site', 'prefix' => 'admin'], function() { 
    Route::get('/', 'Auth\[email protected]'); 
    Route::post('login', 'Auth\[email protected]'); 
    Route::post('logout', 'Auth\[email protected]'); 
}); 
+0

こんにちはを確認してください、答えをいただき、ありがとうございます。 –

+0

@Ali私の答えが役に立つと分かっていればそれはあなたのために受け入れupvoteそれは他の人を助けるように –

+0

baldeを呼び出す方法? 'Route :: get( '/'、 'Auth \ LoginController @ showLoginForm');' –

1

、同様にすべてのあなたのルートを定義します。あなたは5.2

Route::auth(); 

を使用している場合は、5.3

Auth::routes(); 

を使用している場合

し、手動で認証ルートを構築する:だからroutesファイルからこれを削除してください。

+1

こんにちは、ありがとうございました。 –

0

こんにちは、あなたのルート/ 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\[email protected]')->name('login'); 
関連する問題