Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

yanikkumar's avatar

Bootstrap Toasts instead of Bootstrap alert

I am currently using Bootstrap Alert to show the message.

@if(Session::has('message'))
    <div class="alert alert-{{ session('class') }} alert-dismissible fade show rounded-0"
        role="alert">
        <i class="fa fa-{{ session('icon') }}"></i>
        {{ session('message') }}
        <button type="button" class="btn-close" data-bs-dismiss="alert"
            aria-label="Close"></button>
    </div>
@endif

But I want to use Bootstrap toast with a dynamic message

<div class="toast-container position-fixed bottom-0 end-0 p-3">
	<div id="toast" class="toast align-items-center text-bg-info text-white rounded-0" role="alert" aria-live="assertive" aria-atomic="true">
		<div class="d-flex">
			<div class="toast-body">
           Some Message <i class="far fa-face-smile"></i>
           </div>
             <button type="button" class="btn-close me-2 m-auto"  data-bs-dismiss="toast" aria-label="Close"></button>
      </div>
   </div>
</div>

I've created the alert component. How should I make toast system trigger.

0 likes
3 replies
martinbean's avatar

@yanikkumar Read the Bootstrap docs? It gives you examples on how to trigger a toast notification.

1 like
yanikkumar's avatar

@martinbean Yes it gives the example but the problem is the toast is not triggering on any session. That's the issue I'm facing.

Please or to participate in this conversation.