Wednesday, August 3, 2016

flash implementation

1. Reference
https://github.com/laracasts/flash

2. Installation
a. Run composer require laracasts/flash
b. And then, if using Laravel 5, include the service provider within config/app.php.

'providers' => [
    Laracasts\Flash\FlashServiceProvider::class,
];

3.Usage
a. Within your controllers, before you perform a redirect...

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

    return home();
}

b. Add include flash message on view.
@include('flash::message')

<!-- This is only necessary if you do Flash::overlay('...') -->
<script src="//code.jquery.com/jquery.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

<script>
    $('#flash-overlay-modal').modal();
</script>

No comments:

Post a Comment