2014-05-24 118 views
0

可能是我误解了某些东西,但如果请求是重定向,是否可以检测到控制器的方法(GET)?我想做类似的事情:Laravel 4检测重定向

if(Request::statusCode() == '304') {} 

谢谢!

回答

0

我得到了同样的问题。搜索后,最后传递一个变量与重定向(我使用laravel 5)。

public function method1(){ 
    //detect its redirect or not 
    if(Session::get('isRedirected')){ 
     //this is redirect from method2 
    } 
    else{ 
     //this is regular call 
    } 
} 
public function method2(){ 
    return redirect('method1')->with('isRedirected',1); 
}