caffeinated / flash
Flash Messages for Laravel
Installs: 48 056
Dependents: 7
Suggesters: 0
Security: 0
Stars: 43
Watchers: 5
Forks: 14
Open Issues: 1
Requires
- php: ^7.2|^8.0
- illuminate/support: ^6.0|^7.0|^8.0
Requires (Dev)
- mockery/mockery: ^1.0
README
Laravel 5 flash messages, based off the Laracasts video tutorial on the same topic: Flexible Flash Messages. Originally developed for FusionCMS, an open source content management system.
Quick Installation
Begin by installing the package through Composer.
composer require caffeinated/flash
Once this operation is complete, simply add both the service provider and facade classes to your project's config/app.php
file:
Service Provider
Caffeinated\Flash\FlashServiceProvider::class,
Facade
'Flash' => Caffeinated\Flash\Facades\Flash::class,
And that's it! With your coffee in reach, start flashing out messages!
Usage
Usage is simple. Before redirecting to another page, simply call on Flash
to set your desired flash message. There are a number of methods to assign different levels of priority (info, success, warning, and error).
Success
Flash::success('This is a success message.');
Info
Flash::info('This is an info message.');
Warning
Flash::warning('This is a warning message.');
Error
Flash::error('This is an error message.');
Rendering
To render your flash messages in your view, simply include the bundled view partial in your master layout:
@include('flash::message')
Note that the bundled view partial is geared for Bootstrap out of the box.