You can install the package via composer:
composer require f1uder/laravel-notification
Publish the config file with:
php artisan vendor:publish --tag="laravel-notification"
Add css file (notification.css)
@import "../../public/vendor/laravel-notification/css/notification.css";
@tailwind base;
@tailwind components;
@tailwind utilities;
Add code to template, after body tag
<body>
<livewire:laravel-notification.notice/>
...
</body>
return redirect('/')->notice('message text', 'alert');
return redirect()->route('home')->notice('message text', 'info');
$this->notice('message text', 'alert');
return redirect('/')->notice('message text', 'alert');
$dispatch('notice', {message: 'message text', type: 'alert'});
Usage: notice($message, $type, $timer, $title)
$message
- Message.$type
- Notification type.alert
info
- defaultsuccess
$timer
- 3000 default = 3 sec.$title
- Notification header. Default = null.
config/notification.php
$timer
- Notification display time in seconds.$position
- Notification position.tr
- Top right (default).tl
- Top left.br
- Bottom right.bl
- Bottom left.
The MIT License (MIT). Please see License File for more information.