2017 © Pedro Peláez
 

library alerts

Package for sending alerts with Laravel 5.

image

augstudios/alerts

Package for sending alerts with Laravel 5.

  • Wednesday, March 4, 2015
  • by derekaug
  • Repository
  • 1 Watchers
  • 2 Stars
  • 17 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Alerts

Build Status Total Downloads License, (*1)

About

This package is in very early initial development, things are very likely going change before a stable release is tagged., (*2)

Alerts is a Laravel 5 package that allows you to easily flash alerts to the Session to be consumed on the next request., (*3)

Installation

First, install the package and it's dependencies with composer by running within your application's root folder:, (*4)

composer require augstudios/alerts

Then, you will need to add the the Alerts service provider and facade to your application's configuration in /app/config/app.php., (*5)

'providers' => [
    ...
    'Augstudios\Alerts\AlertsServiceProvider'
];
...

'aliases' => [
    ...
    'Alerts' => 'Augstudios\Alerts\AlertsFacade'
];

Usage

To flash messages, to be displayed on the next request, you can use the Alerts::flash(message, type) method:, (*6)

public function save()
{
    Alerts::flash('Welcome Aboard!', 'info');

    return Redirect::home();
}

There also exists some shortcut methods for each alert type:, (*7)

Alerts::flashInfo('Info message');
Alerts::flashWarning('Warning message');
Alerts::flashDanger('Danger message');
Alerts::flashSuccess('Success message');

To get the previously flashed alerts, use the Alerts::all() method:, (*8)

foreach(Alerts::all() as $alert){
    // this is likely to change so Alert is an object
    // $alert['message'] has message
    // $alert['type'] has type
    // $alert['dismissiable']
}    

If you only want one type of alert, you can use the Alerts::ofType(type) method:, (*9)

Alerts::ofType('info');
Alerts::ofType('warning');
Alerts::ofType('danger');
Alerts::ofType('success');

The Versions

04/03 2015

dev-master

9999999-dev

Package for sending alerts with Laravel 5.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Derek J. Augustine

laravel alerts