laravelcontrollerbootstrap-modalpass-data

How to activate modal from controlller passing data to view. (Laravel)


Suppose I have a login form and a bootstrap modal inside it and after checking login authentication from a controller, I want to pass data to that bootstrap modal. So how can I activate that modal from controller passing data to that modal?


Solution

  • I solved this problem. I passed the data from controller like this

    return view('welcome', ['getData'=>$getData]);
    

    and then i checked condition if there is present data then i showed the modal.

    @if(isset($getData))
    <script>
        $('#resultModal').modal('show')
    </script>
    

    @endif