Flexible Toastr JS Alert System for PHP/Laravel.
composer require plusemon/notify
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel Notify</title>
<link rel="stylesheet" href="https://cdn.bootcss.com/toastr.js/latest/css/toastr.min.css" />
</head>
<body>
<!-- Main Contents -->
<h1>Laravel Toastr Notify Notification</h1>
<!-- jQuery CDN -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<!-- Toastr script CDN -->
<script src="https://cdn.bootcss.com/toastr.js/latest/js/toastr.min.js"></script>
<!-- Toastr Scripts render -->
{!! Notify::message() !!}
</body>
</html>
<!-- Example -->
Notify::success('You have successfully added Notify alert system');
notify()->info('Info message with helper function');
<!-- Using Facade -->
Notify::info('message', 'title', ['options']);
Notify::success('message', 'title', ['options']);
Notify::warning('message', 'title', ['options']);
Notify::error('message', 'title', ['options']);
<!-- Clear -->
Notify::clear();
return Notify::info(‘Info redirect back with message by helper function’)->back();
return notify()->info(‘Info redirect with message by helper function’)->redirect(‘/‘);
Add the service provider to config/app.php
Plusemon\Notify\NotifyServiceProvider::class,
Optionally include the Facade in config/app.php if you’d like.
'Notify' => Plusemon\Notify\Facades\Notify::class,
Publish the config file
php artisan vendor:publish --provider=Plusemon\Notify\NotifyServiceProvider
For More visit toastr’s documentation to custom your need.
jQuery toast, you need to add css and js to your html.