Download the PHP package hotsaucejake/toastr-5-laravel without Composer
On this page you can find all versions of the php package hotsaucejake/toastr-5-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hotsaucejake/toastr-5-laravel
More information about hotsaucejake/toastr-5-laravel
Files in hotsaucejake/toastr-5-laravel
Package toastr-5-laravel
Short Description Easy toastr notifications for Laravel 5
License MIT
Homepage https://github.com/hotsaucejake/toastr-5-laravel
Informations about the package toastr-5-laravel
toastr
Easy toastr.js notifications for Laravel 5, a ported version of Laravel 4 Toastr by kamaln7
Installation
- Either run
composer require hotsaucejake/toastr-5-laravel
or add"hotsaucejake/toastr-5-laravel": "dev-master"
to therequire
key incomposer.json
and runcomposer install
- Add
'Kamaln7\Toastr\ToastrServiceProvider',
to theproviders
key inconfig/app.php
(optional for Laravel 5.5) - Add
'Toastr' => 'Kamaln7\Toastr\Facades\Toastr',
to thealiases
key inconfig/app.php
(optional for Laravel 5.5)
Usage
Include jQuery and toastr.js in your master view template, and the output of Toastr::render()
afterwards:
Call one of these methods in your controllers to insert a toast:
Toastr::warning($message, $title = null, $options = [])
- add a warning toastToastr::error($message, $title = null, $options = [])
- add an error toastToastr::info($message, $title = null, $options = [])
- add an info toastToastr::success($message, $title = null, $options = [])
- add a success toastToastr::add($type: warning|error|info|success, $message, $title = null, $options = [])
- add a toastToastr::clear()
- clear all current toasts
Setting custom Toastr options
You can set custom options for Toastr. Run:
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 a list of available options, see toastr.js' documentation.