<commit_before># Laravel Convenient System notifications

[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
[![Laravel Version](https://img.shields.io/badge/laravel-5-orange.svg?style=flat-square)](http://laravel.com)

Notification system for Laravel 5.

After saving some data from user, often, you have to redirect to proper page ans notificate user, that everything done successfully, or, some errors appeared.

Now you can do this more convenient and easy.

## Install

Add

``` JSON
"gaaarfild/laravel-notifications": "dev-master"
```

to your `composer.json` file into `require` section.

Then type in console

``` BASH
$ composer update
```

When update completed, add to your `config/app.conf` file to `providers` section

``` PHP
'providers' => [
    // ...
    Gaaarfild\LaravelNotifications\LaravelNotificationsServiceProvider::class,
]
```

If you want to use `Notifications` facade, add to same file at the `aliases` section

``` PHP
'aliases' => [
    // ...
  'Notifications' => Gaaarfild\LaravelNotifications\NotificationsFacade::class,
]
```

## Usage

### Save messages for the next request

``` php
Notifications::set('Your message text', 'type', 'group');
```

$type param used especially for Twitter Bootstrap render. It displays alerts with respective class.
 
i.e. If you set `type` to `danger`, alert with class 'alert alert-danger' will be generated on `toBootstrap()` formate method.

$group param groups messages to groups. :) On the next Request you can retrieve them by group.


### Retrieving messages

#### All messages

``` PHP
Notifications::all()->get();
```

#### Messages by group

``` PHP
Notifications::byGroup()->get();
```

#### Messages by type

``` PHP
Notifications::byType()->get();<commit_msg>readme updated<commit_after># Laravel Convenient System notifications

[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
[![Laravel Version](https://img.shields.io/badge/laravel-5-orange.svg?style=flat-square)](http://laravel.com)

Notification system for Laravel 5.

After saving some data from user, often, you have to redirect to proper page ans notificate user, that everything done successfully, or, some errors appeared.

Now you can do this more convenient and easy.

## Install

Add

``` JSON
"gaaarfild/laravel-notifications": "dev-master"
```

to your `composer.json` file into `require` section.

Then type in console

``` BASH
$ composer update
```

When update completed, add to your `config/app.conf` file to `providers` section

``` PHP
'providers' => [
    // ...
    Gaaarfild\LaravelNotifications\LaravelNotificationsServiceProvider::class,
]
```

If you want to use `Notifications` facade, add to same file at the `aliases` section

``` PHP
'aliases' => [
    // ...
  'Notifications' => Gaaarfild\LaravelNotifications\NotificationsFacade::class,
]
```

## Usage

### Save messages for the next request

``` php
Notifications::set('Your message text', 'type', 'group');
```

`$type` param used especially for Twitter Bootstrap render. It displays alerts with respective class.
 
i.e. If you set `type` to `danger`, alert with class 'alert alert-danger' will be generated on `toBootstrap()` formate method.

`$group` param groups messages to groups. :) On the next Request you can retrieve them by group.


### Retrieving messages

#### All messages

``` PHP
Notifications::all()->get();
```

#### Messages by group

``` PHP
Notifications::byGroup()->get();
```

#### Messages by type

``` PHP
Notifications::byType()->get();
{'fraction_non_alphanumeric': 0.14218272702027215, 'fraction_numerical': 0.0011108025548458762, 'mean_word_length': 4.717460317460318, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5744326', 'n_tokens_mistral': 1143, 'n_tokens_neox': 1062, 'n_words': 356}