Package Data | |
---|---|
Maintainer Username: | Ivan Nikolenko |
Maintainer Contact: | kamal@kamalnasser.net (Kamal Nasser) |
Package Create Date: | 2017-01-13 |
Package Last Update: | 2017-01-15 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-15 15:19:06 |
Package Statistics | |
---|---|
Total Downloads: | 8,642 |
Monthly Downloads: | 4 |
Daily Downloads: | 0 |
Total Stars: | 7 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
toastr.js for Laravel 5.*
Bower
to install plugin via Bower run
bower install toastr
###1
Link to toastr.css <link href="toastr.css" rel="stylesheet"/>
###2
Link to toastr.js <script src="toastr.js"></script>
Easy toastr.js notifications for Laravel 5.*, a ported version of Laravel 4 Toastr by kamaln7
Either run composer require nilsenj/toastr-laravel dev-1.0-stable
or add "nilsenj/toastr-laravel": "dev-1.0-stable"
to the require
key in composer.json
and run composer install
Add 'nilsenj\Toastr\ToastrServiceProvider',
to the providers
key in config/app.php
Add 'Toastr' => 'nilsenj\Toastr\Facades\Toastr',
to the aliases
key in config/app.php
Include jQuery and toastr.js 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 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 for now it's always onYou 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###
<?php
return [
'options' =>
["progressBar" => true,
"positionClass" =>"toast-bottom-right",
"preventDuplicates"=> false,
"showDuration" => 300,
"hideDuration" => 1000,
"timeOut" => 5000,
"extendedTimeOut" => 1000,
"showEasing" => "swing",
"hideEasing"=> "linear",
"showMethod" => "fadeIn",
"hideMethod" => "fadeOut"]
];
For a list of available options, see toastr.js' documentation.