mascame/notify

Notify 是一个通过使用 Bootstrap 类快速通知用户某些信息的包

v1.0.0 2014-10-10 08:23 UTC

This package is not auto-updated.

Last update: 2024-09-25 13:40:58 UTC


README

Notify 是一个通过使用 Bootstrap 类快速通知用户某些信息的包

如果不满足您的需求,这是一个不错的替代方案

安装

在您的 composer.json 中要求此包,然后运行 composer update

"mascame/notify": "dev-master"

添加到 app/config

// the Service Provider
'Mascame\Notify\NotifyServiceProvider'

// the alias
'Notify' => '\Mascame\Notify\Notify'

发布资源和配置

php artisan config:publish mascame/notify

使用

  • 需要 bootstrap 或兼容的框架。
  • 编辑配置文件以满足您的需求。

在模板中

Notify::all();

// blade
{{ Notify::all(); }}

在您的逻辑中

// $autohide = false, $icon = null, $dismissable = false

Notify::success('Successfuly notified!');
Notify::danger('Real danger!');
Notify::info('Informed!');
Notify::warning('Warning!');
Notify::loading('Loading...');

Notify::add($value, $type = 'success', $autohide = false, $icon = null, $dismissable = false);

一个真实世界的示例

// this will autohide and get the default values for icon and dismissable

public function logout()
{
    Auth::logout();
    Notify::success('Successfuly logged out!', true);
    
    return Redirect::to('home');
}

许可证

MIT