valllabh / message
该软件包的最新版本(dev-master)没有可用的许可信息。
Laravel 管理消息的软件包
dev-master
2014-08-05 17:39 UTC
Requires
- php: >=5.4.0
- illuminate/support: 4.2.*
This package is not auto-updated.
Last update: 2024-09-24 02:52:33 UTC
README
Laravel 的消息/警报管理。
特性
- 处理 Flash 或 Same-Request 消息
- 处理验证消息
- 消息分组
- 对消息类型如
errors, information, warnings
完全控制
设置
在 app/config/app.php
-
在
providers
数组中添加服务提供者'Valllabh\Message\MessageServiceProvider'
-
在
aliases
数组中添加外观'Message' => 'Valllabh\Message\Facade\Message'
-
发布配置文件
php artisan config:publish valllabh/message
-
发布视图
php artisan view:publish valllabh/message
用法
添加消息
$message // array, MessageBag $group // any string name of group like 'sign_up_messages', 'website_notices' $flash // true if message needs to be flashed on next request
Message::error( $message, $group = 'global', $flash = false ); Message::info( $message, $group = 'global', $flash = false ); Message::warning( $message, $group = 'global', $flash = false ); Message::success( $message, $group = 'global', $flash = false );
消息添加函数仅仅是 config:types
的键
'types' => [
'success' => array( 'class' => 'alt-success' ),
'error' => array( 'class' => 'alt-danger' ),
'warning' => array( 'class' => 'alt-warning' ),
'info' => array( 'class' => 'alt-info' )
]