Skip to content
gmentiPublic

About

Flash notifications for Laravel

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

26 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Flash notifications for Laravel

Installation

First, pull in the package through Composer.

Add the repository in your composer.json:

"repositories": [
    {
        "url": "https://github.com/mentito/notifier.git",
        "type": "git"
    }
],

And, add the notifier in require dependecies:

"mentito/notifier": "dev-master"

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

'providers' => [
    Mentito\Notifier\NotifierServiceProvider::class,
];

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

'aliases' => [
    'Notifier' => Mentito\Notifier\Notifier:class,
];

Usage

Within your controllers, before you perform a redirect...

public function store()
{
    Notifier::success('Success title!', 'WTF, this notification is very good!');

    return view('welcome');
}

You may also do:

  • Notifier::info('Title', Message')
  • Notifier::success('Title', 'Message')
  • Notifier::error('Title', 'Message')
  • Notifier::danger('Title', 'Message')
  • Notifier::warning('Title', 'Message')

Example with Bootstrap

@if (Notifier::hasNotification())
    @foreach (Notifier::getAll() as $notification)
        <div class = "alert alert-{{ $notification['type'] }}">
            <strong>{{ $notification['content']['title'] }}</strong> {{ $notification['content']['message'] }}
        </div>
    @endforeach
@endif

About

Flash notifications for Laravel

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages