2015-12-26 19 views

回答

10

這是因爲,你是不是使用AUTH中間件你/路線。在你routes.php文件中查找該默認值是:

Route::get('/', function() { 
    return view('welcome'); 
}); 

試試這個封閉件移動到這是當你產生的腳手架中添加的web中間件。你routes.php文件應該是這個樣子的時候完成:

<?php 

/* 
|-------------------------------------------------------------------------- 
| Routes File 
|-------------------------------------------------------------------------- 
| 
| Here is where you will register all of the routes in an application. 
| It's a breeze. Simply tell Laravel the URIs it should respond to 
| and give it the controller to call when that URI is requested. 
| 
*/ 

// Route::get('/', function() { 
//  return view('welcome'); 
// }); 

/* 
|-------------------------------------------------------------------------- 
| Application Routes 
|-------------------------------------------------------------------------- 
| 
| This route group applies the "web" middleware group to every route 
| it contains. The "web" middleware group is defined in your HTTP 
| kernel and includes session state, CSRF protection, and more. 
| 
*/ 

Route::group(['middleware' => ['web']], function() { 
    // 
}); 

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

    // Add this! 
    Route::get('/', function() { 
     return view('welcome'); 
    }); 

    Route::get('/home', '[email protected]'); 
}); 
+1

它的工作原理,我看到做這種方式,這樣我可以排除不必應對認證路線的重要性:) – eMM

相關問題