Utility package for displaying flash notifications in Laravel.
The package is not published to Packagist so the only way to install it is via a vcs repository entry to your
composer.json
.
{
"repositories": [
{
"type": "vcs",
"url": "git@github.com:lazabogdan/laravel-flash-notification.git"
}
],
"require": {
"lazabogdan/laravel-flash-notification": "dev-master"
}
}
Add to
providers
in config/app.php
LazaBogdan\FlashNotification\FlashNotificationServiceProvider::class
Trigger a flash notification.
use LazaBogdan\FlashNotification\FlashNotification;
public function create()
{
// Success notification
FlashNotification::success('Yay! Changes were saved.');
// Error notification
FlashNotification::error('Ouch! Changes were not saved.');
// Info notification
FlashNotification::message('Hmm! Just a message.');
return back();
}
Display the notification somewhere in your layout.
@include('flash-notification::flash-notification')