## Dependencies
You will need to include `toastr.js` on your pages.
You can install using bower
``` bash
$ bower install toastr
or include from CDNjs., (*4)
``` html
, (*5)
*This may not be the most up to date information, see [CodeSeven/toastr][link-toastr]*
## Setup
### Provider Setup
Add the service provider to the providers array in your `config/app.php`
``` php
'providers' => [
TaylorNetwork\Toastr\ToastrServiceProvider::class,
],
Facade Setup
Add the Toastr facade to your aliases array in config/app.php, (*6)
While this is optional, it is greatly recommended because Toastr::render() will be used in your base view and is easier than having to include the Toastr class., (*7)
Will add config/toastr.php to your project., (*10)
View Setup
You will need to include the toastr.js and toastr.css files from bower or CDNjs (see Dependencies section above) in your base views., (*11)
You will also need to add the following line after both files are included in order to render Toastr messages., (*12)
``` php
// app.blade.php, (*13)
, (*14)
{!! Toastr::render() !!}, (*15)
## Usage
Include `TaylorNetwork\Toastr\Facades\Toastr` in what ever class you plan on generating a Toastr message.
By default the styles available are `success`, `error`, `info`, `warning`. But you can remove any in `config/toastr.php`
`TaylorNetwork\Toastr\Toastr` uses a magic method to generate toastr messages.
To generate a success message
``` php
Toastr::success('Congratulations!');
Will push a success message to the session and will appear on the next request., (*16)
The magic method accepts a minimum of one parameter, the text you want to be displayed. The optional second parameter is the title of the message., (*17)
To add a custom title to the toastr message, (*18)
php
Toastr::info('This is information!', 'New Info!!!');, (*19)