xutl / laravel-notify
这是一个 Laravel 的闪存通知消息。
dev-master / 1.0.x-dev
2018-09-14 03:42 UTC
Requires
- laravel/framework: 5.6.* | 5.5.* | 5.4.* | 5.3.* | 5.2.* | 5.1.* | 5.0.*
Requires (Dev)
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2024-09-11 02:44:54 UTC
README
一个用于在 Laravel 5+ 中向视图发送消息的简单包。
安装
首先,使用 composer 如下要求包
composer require xutl/laravel-notify
在 Laravel 的 app.php 文件中添加服务提供者和别名。
'providers' => [ ... XuTL\Notify\FlashNotifyServerProvider::class, ], ... 'aliases' => [ ... 'Notify' => XuTL\Notify\Notify::class, ],
使用方法
要使用 Notify,简单地在您的 PHP 文件顶部添加 use Notify,然后使用 Notify 门面调用它。
Notify::info('This is an info message'); Notify::success('This is a success message'); Notify::warning('This is a warning message'); Notify::error('This is an error message');
您也可以为消息添加一个标题,如果需要的话
Notify::error($message, $title); // By default, the $title variable is set to null. Notify::error('Something is broken', 'ERROR MESSAGE');