Laravel 8.x Toastr Notifications Example Tutorial

Toastr is awesome JavaScript library that help to display message in the form of notification, the message could be type of info, success, warning or error . When a user signs up on your website or performs an action that needs a notification. A good option is to use the ToastrJS library. 

But in this tutorial i will use this packages  to complete Toastr notification system in our laravel app. You can read this documentation also. i thinks it is pretty awesome and simple also easy to customize visualization. 

In this tutorial i will show you how to use toast message in laravel 8. Toastr is awesome plugin to show awesome messages to user. So let's start how to add toastr js in laravel application.



Step 1 : Install toastr

Run the below command to install Toastr notification package

composer require brian2694/laravel-toastr


That's it! The package is auto-discovered on 5.5 and up!

Laravel <= 5.4

Add the service provider to config/app.php



Optionally include the Facade in config/app.php if you'd like.

'Toastr'  => Brian2694\Toastr\Facades\Toastr::class,



You can set custom options for customizing your notification view. Run:

php artisan vendor:publish


to publish the config file for toastr. You can see toastr's documentation to custom your need.


jQuery toast, you need to add css and js to your html. So now add those following code to your master template file before closing the body tag.


and before closing the head tag, paste the following link.


now add the below code to your controller like below.

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Brian2694\Toastr\Facades\Toastr;

class PostController extends Controller
     public function store(Request $request)
       //Your code goes here
      Toastr::success('Post added successfully :)','Success');


Hope it will work for you.


#laravel #toastr #toastr-notification #laravel-toastr #toastr-notification-example