search

Home  >  Q&A  >  body text

laravel redirect jump failure

Jump failure in laravel
I did not write the jump in the method that comes with the controller, but customized a method to handle the jump, and then I found that there was no jump at all. . .
May I ask why? . .

private function checkExist($id){

    //获取用户是否有提交过
    $info = getIfno($id);//简写如果这条信息存在就跳转到403错误页面
    
    
    if(isset($info)){
        return Redirect::to("Error/403");
    }

}

上述方法在 index方法中调用,然后发现访问时,依然展示的是index对应的页面,而不是错误403.
巴扎黑巴扎黑2871 days ago900

reply all(2)I'll reply

  • ringa_lee

    ringa_lee2017-05-16 16:54:36

    Have you confirmed whether isset($info) is always false? If false, the code inside will not be executed.

    reply
    0
  • 天蓬老师

    天蓬老师2017-05-16 16:54:36

    Is it resolved? I also encountered this problem

    if(!Auth::user()->hasRole("admin")) {
        return redirect()->redirect('manage/company/list');
    }

    reply
    0
  • Cancelreply