Laravel how to redirect back to boostrap modal dialog window

前端 未结 4 1452
时光取名叫无心
时光取名叫无心 2021-02-06 07:55

I want to return to my modal dialog edit form to show validation errors but using Redirect::back I just end up at the HTML page without the modal window.

I

4条回答
  •  故里飘歌
    2021-02-06 08:09

    I just did something like this. You just need to use blade's templating!

    //pass back a variable when redirecting
    return Redirect::back()->with('error_code', 5);
    

    And then in your blade template:

    @if(!empty(Session::get('error_code')) && Session::get('error_code') == 5)
    
    @endif
    

    This will opens the dialog whenever there is error_code is present and equals to 5!

提交回复
热议问题