Package Data | |
---|---|
Maintainer Username: | carlosrgzm |
Maintainer Contact: | kamal@kamalnasser.net (Kamal Nasser) |
Package Create Date: | 2016-03-19 |
Package Last Update: | 2017-09-23 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-26 15:16:14 |
Package Statistics | |
---|---|
Total Downloads: | 1,773 |
Monthly Downloads: | 41 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Easy toastr.js notifications for Laravel 5.5, a ported version of Laravel 4 Toastr by kamaln7
composer require carlosrgzm/toastr-5-laravel
or add "carlosrgzm/toastr-5-laravel": "^2.0"
to the require
key in composer.json
and run composer install
'Kamaln7\Toastr\ToastrServiceProvider',
to the providers
key in config/app.php
'Toastr' => 'Kamaln7\Toastr\Facades\Toastr',
to the aliases
key in config/app.php
Include jQuery and toastr.js in your master view template, and the output of Toastr::render()
afterwards:
<link href="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.min.css" rel="stylesheet">
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.min.js"></script>
{!! Toastr::render() !!}
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
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 a list of available options, see toastr.js' documentation.