1//pass back a variable when redirecting
2return Redirect::back()->with('error_code', 5);
3
4//in blade tempalte
5@if(!empty(Session::get('error_code')) && Session::get('error_code') == 5)
6<script>
7$(function() {
8 $('#myModal').modal('show');
9});
10</script>
11@endif
12
13//second seneario use like this
14 <script type="text/javascript">
15 @if(!empty(Session::get('error_code')))
16 <?php $a = Session::get('error_code'); ?>
17 $('#updateCarModel{{ $a }}').modal('show');
18 console.log("#updateCarModel{{ $a }}");
19 @endif
20</script>
21//@sujay