alex-oliveira/ao-alert

Laravel 5.* + Bootstrap 3 的警报资源

1.0.1 2017-02-14 16:33 UTC

This package is auto-updated.

Last update: 2024-09-25 22:47:35 UTC


README

Laravel 5.1 + Bootstrap 3 的警报资源

1) 安装

$ composer require alex-oliveira/ao-alert

2) config/app.php

'providers' => [
    /*
     * Vendors Service Providers...
     */
    AoAlert\AlertServiceProvider::class,
],
'aliases' => [
    /*
     * Vendors Facades...
     */
    'Alert' => AoAlert\AlertFacade::class,
],

3) 使用

在模板或视图中显示警报。

{!! alert()->show() !!}

在会话中添加新消息。

alert()->info('message');
alert()->success('message');
alert()->warning('message');
alert()->danger('message');

添加多个消息。

alert()->info(['message a', 'message b', 'message c']);

添加具有多个主题的消息。

alert()->danger('message', ['topic a', 'topic b', 'topic c']);

在会话中添加新的自定义消息。

/* CSS */
.alert-custom{
    background: #ccc
}

/* PHP */
alert()->add('alert-custom', 'message');