agilesdesign/flasher

Flash messaging library for Laravel

v1.0.0-alpha.1 2016-11-22 01:54 UTC

This package is auto-updated.

Last update: 2024-11-22 22:42:13 UTC


README

StyleCI Total Downloads

flasher

Flash messaging library for Laravel

Credit to Jeffrey Way over at Laracasts. This package is highly inspired from his flash library.

Installation

Include through composer

composer require agilesdesign/flasher

Add to provider list
'providers' => [
    agilesdesign\Laravel\Flasher\Providers\FlasherServiceProvider::class,
];

Usage

Flash message to Session
flasher()->alert('Please login', Notifier::INFO);
Render
Bootstrap Alerts
@foreach($alerts->messages() as $level => $alert)
    @foreach($alert as $message)
    <div class="alert alert-{{ $level }}">
    	<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
    	{{ $message }}
    </div>
    @endforeach
@endforeach
notie
@foreach($alerts->messages() as $level => $alert)
    @foreach($alert as $message)
         notie.alert(
            "@if($level == 'danger'){{ 'error' }}@else{{ $level }}@endif",
            "{{ $message }}",
            2
        );
    @endforeach
@endforeach