2017 © Pedro Peláez
 

library notifications

Notifications

image

arthurguy/notifications

Notifications

  • Wednesday, June 17, 2015
  • by ArthurGuy
  • Repository
  • 1 Watchers
  • 0 Stars
  • 502 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 1 % Grown

The README.md

Notifications

Installation

First, pull in the package through Composer., (*1)

"require": {
    "arthurguy/notifications": "~1.0"
}

And then, if using Laravel 5, include the service provider within app/config/app.php., (*2)

'providers' => [
    'ArthurGuy\Notifications\NotificationServiceProvider'
];

And, for convenience, add a facade alias to this same file at the bottom:, (*3)

'aliases' => [
    'Flash' => 'ArthurGuy\Notifications\NotificationFacade'
];

Usage

Within your controllers, before you perform a redirect..., (*4)

public function store()
{
    Notification::message('Welcome Aboard!');

    return Redirect::home();
}

You may also do:, (*5)

  • Notification::info('Message')
  • Notification::success('Message')
  • Notification::error('Message')
  • Notification::warning('Message')

Again, if using Laravel, this will set a few keys in the session:, (*6)

  • 'flash_notification.message' - The message you're flashing
  • 'flash_notification.details' - A MessageBag object, ideal for field error messages
  • 'flash_notification.level' - A string that represents the type of notification (good for applying HTML class names)

Alternatively, again, if you're using Laravel, you may reference the flash() helper function, instead of the facade. Here's an example:, (*7)

/**
 * Destroy the user's session (logout).
 *
 * @return Response
 */
public function destroy()
{
    Auth::logout();

    notification()->success('You have been logged out.');

    return home();
}

Or, for a general information flash, just do: notification('Some message');., (*8)

With this message flashed to the session, you may now display it in your view(s). Maybe something like:, (*9)

@if (Session::has('flash_notification.message'))


{{ Session::get('flash_notification.message') }}
@endif

The Versions

17/06 2015

dev-master

9999999-dev

Notifications

  Sources   Download

MIT

The Requires

 

The Development Requires

17/06 2015

1.0.0

1.0.0.0

Notifications

  Sources   Download

MIT

The Requires

 

The Development Requires