2015-09-30 44 views
0

我使用Ryan Durham的sentinel https://github.com/rydurham/Sentinel與Laravel 5.1。在Laravel 5.1的特定路線上使用rydurham Sentinel

我曾經使用Confide https://github.com/Zizaco/confide與Larvel 4.2。

有了傾訴,我能夠成爲auth添加到任何路線這樣

// Applies auth filter to the routes within orders/ 
Route::when('orders/*', 'auth'); 

我已經通過哨兵文檔搜索這個功能,但我不能找出如何完成這件事。我可以在控制器的構造中爲adminuser授權,但我需要在特定路由上具有特定的身份驗證功能。

我的問題是,我怎麼能重定向user誰去使用rydurham sentinel只爲admin路線以乾淨的方式相同Confide?

回答

0

您應該在路由上使用定位中間件。類似於

Route::get('orders', ['middleware' => 'sentry.admin', function() { 
    // return view; 
}]);