nilsenj/toastr-5.1-laravel 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nilsenj/toastr-5.1-laravel

Composer 安装命令:

composer require nilsenj/toastr-5.1-laravel

包简介

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

README 文档

README

toastr.js for Laravel 5.1

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>

###3 toastr

Easy toastr.js notifications for Laravel 5.1, a ported version of Laravel 4 Toastr by kamaln7

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

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

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

<?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.

统计信息

  • 总下载量: 28.76k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固