PHPackages                             nilsenj/toastr-5.1-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. nilsenj/toastr-5.1-laravel

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

nilsenj/toastr-5.1-laravel
==========================

toastr.js for Laravel 5.1/5.2 easy notification like growl for example

631.1k↓25%[1 issues](https://github.com/nilsenj/toastr-5.1-laravel/issues)PHP

Since Mar 13Pushed 10y ago2 watchersCompare

[ Source](https://github.com/nilsenj/toastr-5.1-laravel)[ Packagist](https://packagist.org/packages/nilsenj/toastr-5.1-laravel)[ RSS](/packages/nilsenj-toastr-51-laravel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

toastr-5.1-laravel
==================

[](#toastr-51-laravel)

toastr.js for Laravel 5.1

**Bower**

to install plugin via Bower run

***bower install toastr***

\###1 Link to toastr.css ``

\###2 Link to toastr.js ``

\###3 toastr
============

[](#3toastr)

Easy [toastr.js](http://codeseven.github.io/toastr/) notifications for Laravel 5.1, a ported version of Laravel 4 Toastr by [kamaln7](https://github.com/kamaln7/toastr)

Installation
------------

[](#installation)

1. Either run `composer require nilsenj/toastr-5.1-laravel`or add `"nilsenj/toastr-5.1-laravel": "dev-master"` to the `require` key in `composer.json` and run `composer install`
2. Add `'nilsenj\Toastr\ToastrServiceProvider',` to the `providers` key in `config/app.php`
3. Add `'Toastr'          => 'nilsenj\Toastr\Facades\Toastr',` to the `aliases` key in `config/app.php`

Usage
-----

[](#usage)

Include jQuery and [toastr.js](http://codeseven.github.io/toastr/) and plugin styles in your master view template

after everything is done do

```
{!! Toastr::render() !!}
```

in your template just bofore body closing tag or after toastr.js script instantiated in your file.

You can use these methods in your controllers to insert a toast:

- `Toastr::warning($message, $title = null, $options = [])` - add a warning toast
- `Toastr::error($message, $title = null, $options = [])` - add an error toast
- `Toastr::info($message, $title = null, $options = [])` - add an info toast
- `Toastr::success($message, $title = null, $options = [])` - add a success toast
- `Toastr::add($type: warning|error|info|success, $message, $title = null, $options = [])` - add a toast
- **`Toastr::clear()` - clear all current toasts** don't forget to use it

### Setting custom Toastr options

[](#setting-custom-toastr-options)

You can set custom options for Toastr. Run:

```
php artisan vendor:publish
```

to publish the config file for Toastr. Then edit `config/toastr.php` and set the `options` array to whatever you want to pass to Toastr. These options are set as the default options and can be overridden by passing an array of options to any of the methods in the **Usage** section.

\###for example###

```
