Download the PHP package xuzh/toastr_flash without Composer
On this page you can find all versions of the php package xuzh/toastr_flash. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download xuzh/toastr_flash
More information about xuzh/toastr_flash
Files in xuzh/toastr_flash
Package toastr_flash
Short Description Bootstrap and toastr Easy flash notifications
License MIT
Informations about the package toastr_flash
Easy Flash Messages
Installation
First, pull in the package through Composer.
Run composer require xuzh/toastr_flash
And then, if using Laravel 5, include the service provider within config/app.php
.
And, for convenience, add a facade alias to this same file at the bottom:
Usage
Within your controllers, before you perform a redirect...
You may also do:
Flash::info('Message')
Flash::success('Message')
Flash::error('Message')
Flash::warning('Message')
Flash::overlay('Modal Message', 'Modal Title')
Again, if using Laravel, this will set a few keys in the session:
- 'flash_notification.message' - The message you're flashing
- 'flash_notification.level' - A string that represents the type of notification (good for applying HTML class names)
Alternatively, again, if you're using Laravel, you may reference the flash()
helper function, instead of the facade. Here's an example:
Or, for a general information flash, just do: flash('Some message');
.
With this message flashed to the session, you may now display it in your view(s). Maybe something like:
Note that this package is optimized for use with Twitter Bootstrap.
Because flash messages and overlays are so common, if you want, you may use (or modify) the views that are included with this package. Simply append to your layout view:
Example
If you need to modify the flash message partials, you can run:
The two package views will now be located in the app/views/packages/laracasts/flash/
directory.