Hello Artisan,
In this toastr laravel 9 tutorial, I will show you how to implement toastr notification in Laravel 9 application. If you are facing toastr laravel 9 not working then this example is for you. I will show you step by step installation guide.
To create this toastr notification, I will use this brian2694/laravel-toastr
package. Toastr is an awesome JavaScript library that helps to display a message in the form of a notification, the message could be the 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.
Step 1 : Install toastr
Run the below command to install Toastr notification package
composer require brian2694/laravel-toastr
You can set custom options for Reminder. Run:
php artisan vendor:publish
Step 2: Calling Tosatr
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)
{
Toastr::success('Post added successfully :)','Success');
}
}
And now add the following snippet to you master file:
Read also: How to Take Screenshots in Laravel 9 Example
Now you can test.
#laravel #laravel-9x