Simple laravel flash package used across systems
If you are using Laravel 5.4 or below, you will need to add the Service Provider below in manually to the config/app.php file. Otherwise it will be autoloaded on Laravel 5.5+
Provider:
Industrious\Flash\FlashServiceProvider::class,
You will need to include the below partials in layouts file, so its available on all views.
@include('industrious-flash::flash-messages')
To use it, simply include FlashesMessages
Trait where required.
use Industrious\Flash\Traits\FlashesMessages;
...
use FlashesMessages;
You will then have access to the method and be able to use it as below;
$this->flash('danger', 'Session has expired due to inactivity');
$this->flash('success', 'Successfully updated user details');
The first parameter refers to bootstrap style
and the second parameter is the message
that will be displayed.
Check out the Bootstrap documentation for all styling possibilities