Introduction
, (*1)
Easy Flash Messages for Your Laravel 5.4+ Application, (*2)
Main features
This composer package offers a Twitter Bootstrap optimized flash messaging setup for your Laravel 5.4+ Applications., (*3)
Requirements
Installation
Begin by pulling in the package through Composer., (*4)
$ 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., (*5)
// 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., (*6)
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
Usage
Within your controllers, before you perform a redirect, use Flash
facade., (*7)
public function save()
{
Flash::success('Save success!')->important();
return redirect('/home');
}
You may also do:, (*8)
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., (*9)
@include('flash::message')
Changelog
See all change logs in CHANGELOG, (*10)
Testing
$ git clone git@github.com/oanhnn/laravel-flash-message.git /path
$ cd /path
$ composer install
$ composer phpunit
Contributing
Please see CONTRIBUTING for details., (*11)
Security
If you discover any security related issues, please email to Oanh Nguyen instead of
using the issue tracker., (*12)
Credits
License
This project is released under the MIT License.
Copyright © 2017-2018 Oanh Nguyen., (*13)