2017 © Pedro Peláez
 

library notification

notifications

image

gertjanroke/notification

notifications

  • Tuesday, May 24, 2016
  • by GertjanRoke
  • Repository
  • 1 Watchers
  • 0 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Notification

Flash notification that accepts a array and string. You can use it from your controller and also in the views., (*1)

Install

composer require gertjanroke/notification

After install

ServiceProvider

Add the following line to config/app.php., (*2)

at providers:, (*3)

Gertjanroke\Notification\NotificationServiceProvider::class,

And at aliases:, (*4)

'Notification' => Gertjanroke\Notification\Facade\Notification::class,

Publish files

Run the following command:, (*5)

php artisan vendor:publish

Usage

Including the flash message in your view

To see the flash notification(s), you need to add the following @include()., (*6)

@include('notification::message')

And if you want the basic styling that comes with the package, also inlcude the following lines:, (*7)

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="{{ asset('assets/css/notification-style.css') }}">

And the javascript:, (*8)

<script src="{{ asset('assets/js/notification.js') }}"></script>
NOTE: You also need the jQuery library.

Usage from the Controller

available functions

Creating a notification can be done with the next commands:, (*9)

Notification::
    - success()
    - error()
    - warning()
    - info()
    - overlay() // Bootstrap modal

You can also add the class "Important" to the alert message, with the following command:, (*10)

Notification::error('message', 'title')->important();

Message variables

You can send a message as a string or as a array., (*11)

Syntax:, (*12)

Notification::success([
                    'First success',
                    'Second success title' => [
                        'First success',
                        'Second success'
                    ],
                    'Third success'
                ]);

Notification::success('First success');

Title

The last string is the title. You have two options: give a string or leave it blank., (*13)

With title:, (*14)

Notification::success('First success', 'Title success block');

Without title:, (*15)

Notification::success('First success');

Overlay function

When you want to use a Modal from bootstrap you can do so with the following function and syntax:, (*16)

Notification::overlay( 'Message', 'Title' );
NOTE: All the given variables need to be a string.

Usage from the view

You can also create a notification from the view file, this is usefull when your using a ajax form., (*17)

available functions

Creating a notification can be done with the next commands:, (*18)

Notification.
    - success()
    - error()
    - warning()
    - info()
    - overlay() // Bootstrap modal

Messages, Title and Important

You can send a message as a string or as a array., (*19)

NOTE: The overlay function only accepts strings.

Messages

The following syntax is used at all functions but NOT FOR: .overlay():, (*20)

Single message:, (*21)

Notification.success( 'First message' );

Multiple single messages:, (*22)

Notification.success( ['First message', 'Second message', 'Third message'] );

Grouping messages:, (*23)

Notification.success( {'Third message with array': ['First message', 'Second message']} );

Grouping messages inside a Array of messages:, (*24)

Notification.success( ['First message', 'Second message', {'Third message with array': ['First message', 'Second message']}] );

Title

Adding a title to a notification:, (*25)

Notification.success( 'message', 'The Title goes after the message' );

Important

Adding the class important to your notification is easly done with adding a boolean as last variable:, (*26)

Notification.success( 'message', 'Title', TRUE );

Overlay function

When you want to use a Modal from bootstrap you can do so with the following function and syntax:, (*27)

Notification.overlay( 'Message', 'Title', 'Button text' );
NOTE: All the given variables need to be a string.

The Versions

24/05 2016

dev-master

9999999-dev https://github.com/gertjanroke/notification

notifications

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

notification notifications

22/04 2016

1.1.0

1.1.0.0 https://github.com/gertjanroke/notification

notifications

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

notification notifications

14/03 2016

1.0.1

1.0.1.0 https://github.com/snatertj/notification

notifications

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

notification notifications

12/03 2016

1.0.0

1.0.0.0 https://github.com/snatertj/notification

notifications

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

notification notifications

20/10 2015

0.0.2

0.0.2.0 https://github.com/intothesource/notification

notifications

  Sources   Download

BSD-2

The Requires

  • php >=5.3.0

 

The Development Requires

notification notifications the source thesource in to the source intothesource

19/10 2015

0.0.1

0.0.1.0 https://github.com/intothesource/notification

notifications

  Sources   Download

BSD-2

The Requires

  • php >=5.3.0

 

The Development Requires

notification notifications the source thesource in to the source intothesource