2017 © Pedro Peláez
 

library toastr

A laravel class that will generate Toastr messages using toastr.js

image

taylornetwork/toastr

A laravel class that will generate Toastr messages using toastr.js

  • Wednesday, November 16, 2016
  • by taylornetwork
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Toastr for Laravel

A simple facade for Laravel 5 to generate toastr message using toastr.js., (*1)

Install

Via Composer, (*2)

``` bash $ composer require taylornetwork/toastr, (*3)


## 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)

``` php 'aliases' => [, (*8)

'Toastr' => TaylorNetwork\Toastr\Facades\Toastr::class,

],, (*9)


### Publishing Config ``` bash $ php artisan vendor:publish

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)

Credits

License

The MIT License (MIT). Please see License File for more information., (*20)

The Versions

16/11 2016

dev-master

9999999-dev

A laravel class that will generate Toastr messages using toastr.js

  Sources   Download

The Requires

 

by Sam Taylor

16/11 2016

1.0.0

1.0.0.0

A laravel class that will generate Toastr messages using toastr.js

  Sources   Download

The Requires

 

by Sam Taylor