g9zz / reminder
一个使用 toastr 构建,适用于 laravel5.* 的消息提醒
v1.1
2017-01-06 17:58 UTC
Requires
- illuminate/support: ~5.0
This package is not auto-updated.
Last update: 2024-09-23 13:36:55 UTC
README
灵感来自 laracasts flash
安装
使用 Composer
composer require g9zz/reminder
将服务提供者添加到 config/app.php
G9zz\Reminder\ReminderServiceProvider::class,
可选地,如果您想使用 Facade,请在 config/app.php 中包含它。
'Reminder' => G9zz\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 的文档 来自定义您的需求。