2017 © Pedro Peláez
 

library laravel-notify

Provides an ready to use object oriented notification interface for laravel 4, including working example javascript and css for Twitter Bootstrap 3

image

ipunkt/laravel-notify

Provides an ready to use object oriented notification interface for laravel 4, including working example javascript and css for Twitter Bootstrap 3

  • Wednesday, November 26, 2014
  • by rokde
  • Repository
  • 4 Watchers
  • 4 Stars
  • 148 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 3 Versions
  • 6 % Grown

The README.md

laravel-notify

Latest Stable Version Latest Unstable Version License Total Downloads, (*1)

Provides an ready to use object oriented notification interface for laravel 4, including working example javascript and css for Twitter Bootstrap 3, (*2)

Installation

Add to your composer.json following lines, (*3)

"require": {
    "ipunkt/laravel-notify": "1.*"
}

Add 'Ipunkt\LaravelNotify\LaravelNotifyServiceProvider', to providers in app/config/app.php. The Service provider also registers an alias Notify to your application., (*4)

On command line publish the database migrations:, (*5)

$> php artisan migrate --package="ipunkt/laravel-notify"

Usage

Add somewhere in your bootstrap the shipped view composer to auto-handle the given view script:, (*6)

View::composer('laravel-notify::notification', 'Ipunkt\LaravelNotify\Composers\ViewComposer');

The view composer injects a variable $notifications into the view. It is a collection of all notifications that were created or read., (*7)

Now you can use this template to display all notifications or you can use it with Bootstrap 3 in your navbar like this., (*8)

$> php artisan asset:publish ipunkt/laravel-notify

And then include the following files in your layout: /packages/ipunkt/laravel-notify/css/notify.css and /packages/ipunkt/laravel-notify/js/notify.js. The latter needs jquery to be existent., (*9)

Then go to your layout and create an <li id="notify"><a href="{{{ URL::route('notify.index') }}}"><i class="glyphicon glyphicon-warning-sign"></i></li> in your navbar navigation list., (*10)

Whenever there are notifications to be listed the ViewComposer initially fills the $notifications variable in the shipped notification view and the javascript makes an ajax call to get these and displays as menu. Without javascript the link opens a page where all notifications will be listed., (*11)

Important Notice

Do not forget to set filters for the routes build by the package. For example:, (*12)

Route::when('notify/*', 'auth');

This example adds the auth filter to all package build routes., (*13)

Use-Cases

1. Message Notification

If you want to publish a simple message notification just do the following to notify users:, (*14)

$user = Auth::user();
Notify::user($user, new \Ipunkt\LaravelNotify\Types\MessageNotification('Welcome on board!'));
// or
// Notify::users([$user, ...], new \Ipunkt\LaravelNotify\Types\MessageNotification('Welcome on board!'));

This sends a simple shipped message notification to the current logged in user., (*15)

2. Specific Notification

For sending application specific notifications simply create your own NotificationType., (*16)

class MyNotification extends Ipunkt\LaravelNotify\Types\AbstractNotification {
}

Then you can modify the read and done action for your needs. And you can add your own custom actions. You do not have to use only these 3 actions: created, read, done. You can build your own custom workflow. Try it out!, (*17)

The AbstractNotification sends a user to the done action if he reads the notification. Override this behaviour to have your own workflow. Ending with done might be a good one, starting with created is fix by the current implementation., (*18)

The Versions

26/11 2014

dev-master

9999999-dev

Provides an ready to use object oriented notification interface for laravel 4, including working example javascript and css for Twitter Bootstrap 3

  Sources   Download

MIT

The Requires

 

by Bastian Rang (ipunkt Business Solutions)
by Robert Kummer (ipunkt Business Solutions)

laravel jquery bootstrap javascript laravel4 object notification oop

20/11 2014

1.1.0

1.1.0.0

Provides an ready to use object oriented notification interface for laravel 4, including working example javascript and css for Twitter Bootstrap 3

  Sources   Download

MIT

The Requires

 

by Bastian Rang (ipunkt Business Solutions)
by Robert Kummer (ipunkt Business Solutions)

laravel jquery bootstrap javascript laravel4 object notification oop

28/07 2014

1.0.0

1.0.0.0

Provides an ready to use object oriented notification interface for laravel 4, including working example javascript and css for Twitter Bootstrap 3

  Sources   Download

MIT

The Requires

 

by Bastian Rang (ipunkt Business Solutions)

laravel jquery bootstrap javascript laravel4 notification