2017-08-10 29 views
0

我剛剛從其他人這個項目,我得到這個怪異的行爲:路由到「/」只是向我發送到登錄頁面Laravel

只有在web.php路由文件一個「/」。

它的權威性路由組

事情是這樣的:

Route::group(['middleware' => 'auth'], function() { 

    Route::get('/','[email protected]_welcome_view'); 

} 

路線權威性顯然是被記錄在誰的人

現在我想www.mysite.com去歡迎如果你沒有登錄,並在其他地方,如果你已經登錄。

我試圖把另一個路由之外的auth中間件,但它告訴我在它試圖得到非客觀的傾向。

我想要做到這一點的方法是在控制器本身重定向,但我認爲這不是一個乾淨的方法,因爲路由應在web.php完成。

有什麼建議嗎?

回答

1

驗證中間件正在檢查當前用戶是否登錄,如果沒有,則重定向到登錄頁面。 如果您想停止重定向,請從auth中間件組中刪除路由。

Route::get('/','[email protected]_welcome_view'); 

Route::group(['middleware' => 'auth'], function() { 
    /*Here you will put only routes that need the user to authenticate before accessing the page*/ 
} 
相關問題