nibbletech/feedback-messages
最新稳定版本:v1.0
Composer 安装命令:
composer require nibbletech/feedback-messages
包简介
Simple flash session messages
README 文档
README
A package to make it really easy to pass and retrieve messages within the session.
Installation
Composer
Add the package to your composer.json file:
"nibbletech/feedback-messages": "dev-master"
Laravel
In laravel add the following to your app.php:
'providers' => array( ... ... 'Nibbletech\Support\FeedbackServiceProvider' ), 'aliases' => array( ... ... 'Feedback' => 'Nibbletech\Support\Facades\Feedback' )
Usage
You add messages to the session by passing a message, the message type (e.g 'error') and setting an optional channel (defaults to 'global').
To add a message:
Feedback::add('You found a great package!', 'success', 'custom-channel')
Feedback uses magic methods to make it really easy to add messages of a certain type, just call the type you want as the function and the package handles the rest.
These take a message string and an optional 2nd paramater which allows you to set the channel the message goes into, otherwise it defaults to the global channel:
Feedback::info('message', 'optional-channel')
Feedback::error('message')
Feedback::success('message')
Retreiving Messages
All as original structure
To retrieve an array of all messages just call:
Feedback::all();
Specific Channel
You can retrieve an array of all the messages for a specific channel:
Feedback::get('channel-name');
All messages by type
This returns an array of all messages of a specfic type, regardless of their channel
Feedback::byType('error');
统计信息
- 总下载量: 424
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-06-05