也許很簡單,但我完全失去了laravel 4重定向基於控制器關閉的條件
Route::get('/', function()
{
if(Auth::check())
// send traffic to \Controllers\[email protected]
else
// send traffic to \Controllers\Loggedout\[email protected]
});
我已經試過:
Route::controller
URL::action
URL::route
Redirect::route
我也命名爲兩條路線:
Route::get('/', array('as'=>'loggedin', 'uses'=>'Controllers\[email protected]'));
Route::get('/', array('as'=>'loggedout', 'uses'=>'Controllers\Loggedout\[email protected]'));
但似乎沒有什麼工作。
我省略了創建控制器的實際代碼,因爲它非常標準,我知道它可以從Route::get('/', 'Controllers\[email protected]')
起作用,並且它可以正確返回。
是啊,我不斷收到重定向循環。用戶被註銷 - >路由到註銷 - >由於某種原因回到這個得到。是的,我想顯示一個登出的屏幕,如果它是'/',而且如果他們登錄,也是主頁。 –