Skip to content

PHP code snippet – How to return with open model popup in laravel?

//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)
$(function() {
//second seneario use like this
  <script type="text/javascript">
        <?php $a = Session::get('error_code'); ?>
        $('#updateCarModel{{ $a }}').modal('show');
        console.log("#updateCarModel{{ $a }}");
See also  TypeScript code snippet - How to remove second square brackets in an array?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.