how to return with open model popup in laravel
snippet in php

how to return with open model popup in laravel

user4351

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

//in blade tempalte
@if(!empty(Session::get('error_code')) && Session::get('error_code') == 5)
<script>
$(function() {
    $('#myModal').modal('show');
});
</script>
@endif
  
//second seneario use like this
  <script type="text/javascript">
    @if(!empty(Session::get('error_code')))
        <?php $a = Session::get('error_code'); ?>
        $('#updateCarModel{{ $a }}').modal('show');
        console.log("#updateCarModel{{ $a }}");
    @endif
</script>
//@sujay