oanhnn/laravel-flash-message is a Laravel package for laravel flash message for laravel 5.4+.
It currently has 1 GitHub stars and 6.653 downloads on Packagist (latest version v0.1.1).
Install it with composer require oanhnn/laravel-flash-message.
Discover more Laravel packages by oanhnn
or browse all Laravel packages to compare alternatives.
Last updated
Easy Flash Messages for Your Laravel 5.4+ Application
This composer package offers a Twitter Bootstrap optimized flash messaging setup for your Laravel 5.4+ Applications.
Begin by pulling in the package through Composer.
$ composer require oanhnn/laravel-flash-message
Next, if using Laravel 5.5+, you done. If using Laravel 5.4, include the service provider within your config/app.php file.
// config/app.php
'providers' => [
// Other service providers...
Laravel\FlashMessage\FlashMessageServiceProvider::class,
],
'aliases' => [
// Other alias classes
'Flash' => Laravel\FlashMessage\Facades\Flash::class,
],
Finally, as noted above, the default CSS classes for your flash message are optimized for Twitter Bootstrap. As such, pull in the Bootstrap's CSS within your HTML or layout file.
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
Within your controllers, before you perform a redirect, use Flash facade.
public function save()
{
Flash::success('Save success!')->important();
return redirect('/home');
}
You may also do:
| method | description |
|---------------------------------------------|--------------------------------------------------------|
| Flash::success('message') | Set the flash message with theme "success alert". |
| Flash::warning('message') | Set the flash message with theme "warning alert". |
| Flash::error('message') | Set the flash message with theme "error alert". |
| Flash::info('message') | Set the flash message with theme "info alert". |
| Flash::info('message')->important() | Add a close button to the flash message. |
| Flash::info('message')->overlay('title') | Display flash message as a modal overlay with a title. |
And include flash message view into your blade template.
@include('flash::message')
See all change logs in CHANGELOG
$ git clone [email protected]/oanhnn/laravel-flash-message.git /path
$ cd /path
$ composer install
$ composer phpunit
Please see CONTRIBUTING for details.
If you discover any security related issues, please email to Oanh Nguyen instead of using the issue tracker.
This project is released under the MIT License.
Copyright © 2017-2018 Oanh Nguyen.