2017 © Pedro Peláez
 

library laravel5-alerts

Package for managing alerts (messages) in your Laravel 5 application.

image

dberry37388/laravel5-alerts

Package for managing alerts (messages) in your Laravel 5 application.

  • Thursday, April 30, 2015
  • by dberry37388
  • Repository
  • 1 Watchers
  • 1 Stars
  • 191 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Alerts for Laravel 5

Package for managing alerts (messages) in your Laravel 5 application, (*1)

Installation

First things first, let's pull the package in from composer, (*2)

composer require dberry37388/laravel5-alerts

Integrating with Laravel

Open up app.php and add the following to the providers array, (*3)

"Dberry37388\Alerts\AlertsServiceProvider",

Next, let's add the facade. This will let you do things like Alerts::getErrors(). We'll add this to the aliases array., (*4)

'Alerts'    => 'Dberry37388\Alerts\Facades\Alerts'

Published the Config

You can publish the default config to your app/config directory by running the following command:, (*5)

php artisan vendor:publish --provider="Dberry37388\Alerts\AlertsServiceProvider" --tag=config

Usage

Adding a new alert. In this example, we are adding an "info" alert. You can substitute "info" with any type that you need., (*6)

Alerts::error('my message');
Alerts::alert('info', 'Your Message Here');

Adding an alert to a container other than the default:, (*7)

Alerts::error('My message', 'pnotify');
Alerts::alert('errors', 'My message here", "pnotify");

Adding an alert with "extra" attributes. Extra attributes can be used however you want. For example if you want to pass a title, an icon class, etc., (*8)

Alerts::alert('info', 'My message here', null, ['icon' => 'fa fa-info', 'title' => 'Welcome!', 'timeout' => 4000]);

Retrieving all alerts., (*9)

$alerts = Alerts::all();

Retrieving all alerts of a specific type. You simple prefix the "type" with get, for example to retrive all error message: or use the full syntax., (*10)

$errors = Alerts::getError();
$errors = Alerts::whereType('errors');

Retrieving all alerts of a specific type in a specific container, just pass the container as an argument., (*11)

$alerts = Alerts::getError('pnotify');
$errors = Alerts::whereType('errors')->whereInContainer('pnotify');

You can also retrieve all alerts that are not of a specific type. You can pass either a string or an array here., (*12)

$errors = Alerts::notError('errors');
$errors = Alerts::whereNotType('errors');

Containers

Containers can be used to group notifications. For example if you want to pass form validation errors, you could have a "validation" container, or if you want certain notifications to display using a javascript growl type notification, you could group those in a "notifications" container., (*13)

Retrieving all alerts in a specific container, you just prefix the container name with "where":, (*14)

$alerts = Alerts::whereErrors();
$alerts = Alerts::whereInContainer('errors');

To retrieve all alerts in a specific container with a specific type, just pass the type as an argument., (*15)

$alerts = Alerts::whereNotification('info');
$alerts = Alerts::whereInContainer('errors')->whereType('info');

To retrieve all alerts that are not in a specific container. You can pass either a string or an array here., (*16)

$alerts = Alerts::whereNotInContainer('validation');

The Versions

30/04 2015

dev-laravel4

dev-laravel4 https://github.com/dberry37388/laravel5-alerts

Package for managing alerts (messages) in your Laravel 5 application.

  Sources   Download

MIT

The Requires

 

laravel framework support

17/04 2015

dev-master

9999999-dev https://github.com/dberry37388/laravel5-alerts

Package for managing alerts (messages) in your Laravel 5 application.

  Sources   Download

MIT

The Requires

 

laravel framework support

17/04 2015

0.0.1

0.0.1.0 https://github.com/dberry37388/laravel5-alerts

Package for managing alerts (messages) in your Laravel 5 application.

  Sources   Download

MIT

The Requires

 

laravel framework support