garryla
10/13/2017 - 10:05 PM

Laracasts Flash

laracasts/flash

Laracasts Flash

https://github.com/laracasts/flash

This composer package offers a Twitter Bootstrap optimized flash messaging setup for your Laravel applications.

Installation

Begin by pulling in the package through Composer.

composer require laracasts/flash

Next, if using Laravel 5, include the service provider within your config/app.php file.

'providers' => [
    Laracasts\Flash\FlashServiceProvider::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">

Usage

Within your controllers, before you perform a redirect, make a call to the flash() function.

public function store()
{
    flash('Welcome Aboard!');

    return home();
}