bmprbac / yii2-rbac
此包已被废弃,不再维护。作者建议使用 wwwewqe 包。
一个使用 toastr 构建,专为 laravel5.* 定制的优秀消息提醒功能
v1.0
2015-11-21 04:49 UTC
Requires
- illuminate/support: ~5.0
This package is not auto-updated.
Last update: 2022-02-01 12:50:59 UTC
README
灵感来源于 laracasts flash
安装
使用 Composer
composer require rry/reminder
将服务提供者添加到 config/app.php
Rry\Reminder\ReminderServiceProvider::class,
可选:如果您想使用 Facade,请将其包含在 config/app.php 中。
'Reminder' => Rry\Reminder\ReminderFacade::class,
您可以使用可用的 reminder() 函数。
依赖
jQuery toast,您需要将 css 和 js 添加到您的 html 中。
基本使用
您应该在您的 html 中添加 {!! Reminder::message() !!}
。
然后。
-
Reminder::info('foo', 'bar', []);
-
Reminder::success('foo', 'bar', []);
-
Reminder::warning('foo', 'bar', []);
-
Reminder::error('foo', 'bar', []);
-
reminder()->info('foo', 'bar', []);
<?php Route::get('/', function () { Reminder::success('Hi! this is Reminder', 'Hello', ["positionClass" => "toast-bottom-right"]); return view('welcome'); });
<!DOCTYPE html> <html> <head> <title>Laravel</title> <link rel="stylesheet" href="http://cdn.bootcss.com/toastr.js/latest/css/toastr.min.css"> </head> <body> <div class="container"> <div class="content"> <div class="title">Laravel 5</div> </div> </div> <script src="http://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script> <script src="http://cdn.bootcss.com/toastr.js/latest/js/toastr.min.js"></script> {!! reminder()->message() !!} </body> </html>
选项
您可以为 Reminder 设置自定义选项。运行
php artisan vendor:publish
来发布 reminder 的配置文件。
您可以通过查看toastr 的文档来自定义您的需求。