2017 © Pedro Peláez
 

library bootalert

This package will allow you to add system notifications for the user in queue from which they will be removed after display to the user.

image

maksimkurb/bootalert

This package will allow you to add system notifications for the user in queue from which they will be removed after display to the user.

  • Thursday, July 24, 2014
  • by maksimkurb
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

BootAlert

This package designed specially (but can be reconfigured) for Bootstrap 3 and Laravel 4 and will allow you to add system notifications for the user in queue from which they will be removed after display to the user., (*1)

Package installation:

Modify your composer.json to match this:, (*2)

{
    "require": {
        ...
        "maksimkurb/bootalert": "dev-master"
    }
}

and run in terminal this command: composer update, (*3)

Next, you should add these rows to your config/app.php, (*4)

    ...
    'providers' => array(
        ...
        'Maksimkurb\BootAlert\BootAlertServiceProvider',
    ),
    ...

    'aliases' => array(
       ...
       'BootAlert' => 'Maksimkurb\BootAlert\BootAlert',
    ),
    ...

By default, this plugin already configured to use it with Twitter Bootstrap 3, but you can edit configuration as you like., (*5)

To publish config files run: php artisan config:publish maksimkurb/bootalert, (*6)

Using

Add alerts to user session

To add new alert to user session run:, (*7)

    BootAlert::add($type, $message, $dismissable=true);

Where $type - type of alert (for BS3 they are: success, info, warning, danger), see configuration Where $message - your message Where $dismissable - boolean, true = alert dismissable; false - alert static, (*8)

Also you can add validators to BootAlerts:, (*9)

    BootAlert::addValidator($type, $validator, $dismissable=true);

This function add all validator errors to user session and can be displayed after. For now, BootAlert couldn't use per-alert type - you can choose only one for all validator messages (or parse they with BootAlert::add(...) by hands), (*10)

Display alerts to user

You can get HTML code with all alerts of user as follows:, (*11)

BootAlert::display();

NOTE: This function return alerts only once, so after their displaying, they will removed from alerts array and you shouldn't care about old alerts removing., (*12)

The Versions

24/07 2014

dev-master

9999999-dev

This package will allow you to add system notifications for the user in queue from which they will be removed after display to the user.

  Sources   Download

MIT

The Requires

 

by Maxim Kurbatov