I am trying to show a modal after redirection.

I have seen all the ways on the net but nothing worked.

**Controller**

```
return redirect()->back()->with('code');

```

**Blade**

```
@if(session('code')) )
<script>
  $(function() {
    $('#verify_code').modal('show');
  });
</script>
@endif

<div id="verify_code" class="modal custom-modal fade"  role="dialog">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h3 class="modal-title">Verify Phone Number</h3>
      </div><!-- end modal-header -->
      <div class="modal-body">
        <form method="POST" action="{{ url('verify_code') }}">
          @csrf
          <div class="form-group">
            <input type="number" class="form-control" id="code" name="code"  placeholder="Enter verification code" required/>
          </div>
          <button class="btn btn-orange btn-block">Verify Phone Number</button>
        </form>
      </div><!-- end modal-bpdy -->
    </div><!-- end modal-content -->
  </div><!-- end modal-dialog -->
</div><!-- end edit-profile -->

```