arvin/toastr-for-laravel

toastr.js for laravel5

1.0 2017-03-27 03:37 UTC

This package is not auto-updated.

Last update: 2024-09-28 19:36:41 UTC


README

README

安装

  1. 运行 composer require arvin/toastr-for-laravel
  2. Arvin\Toastr\ToastrServiceProvider::class 添加到 config/app.php 中的 providers
  3. 'Toastr' => Arvin\Toastr\Facades\Toastr::class 添加到 config/app.php 中的 aliases
  4. 运行 php artisan vendor:publish

使用

只需将此代码添加到您的 blade 模板文件中

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

在控制器中使用这些方法

Toastr::warning($message, $title = null, $options = []) 
Toastr::error($message, $title = null, $options = []) 
Toastr::info($message, $title = null, $options = [])
Toastr::success($message, $title = null, $options = [])
Toastr::clear() 

配置

config/toastr.php 中设置 toast 选项,可用选项 => toastr.js 演示