2017 © Pedro Peláez
 

library flash

Flash messaging package for use with laravel

image

smodav/flash

Flash messaging package for use with laravel

  • Tuesday, July 26, 2016
  • by SmoDav
  • Repository
  • 1 Watchers
  • 2 Stars
  • 126 Installations
  • CSS
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 2 % Grown

The README.md

Flash Notifier

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

This is a laravel package for displaying flash notifications that extends Sweet Alert and provides an extra custom notice notification on the top left., (*2)

Installation

Pull in the package through Composer., (*3)

Run composer require smodav/flash, (*4)

When using Laravel 5, include the service provider and its alias within your config/app.php., (*5)

'providers' => [
    SmoDav\Flash\FlashServiceProvider::class,
];

'aliases' => [
    'Flash' => SmoDav\Flash\Flash::class,
];

Publish the package specific assets and view using, (*6)

php artisan vendor:publish

This will publish the flash view into resources/views/vendor/smodav/flash/ directory and also its accompanying css and javascript files into their respective resources/assets/ directory., (*7)

Usage

The package comes with a helper function flash() and its respective facade Flash. Within your controllers or closures, use either before a redirect:, (*8)

public function delete()
{
    flash()->success('Users', 'Successfully banned user.');

    return redirect()->route('users.index');
}

// OR

public function delete()
{
    Flash::success('Users', 'Successfully banned user.');

    return redirect()->route('users.index');
}

If you would like the notification to persist till dismissed by the user, use the persist() method on the instance:, (*9)

public function delete()
{
    Flash::success('Users', 'Successfully banned user.')->persist();

    return redirect()->route('users.index');
}

The package has allows you to send different types of flash alerts:, (*10)

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

All the above can be persisted using persist()., (*11)

An additional notice() is included that provides a notice on the top right edge, however, the notice cannot be persisted:, (*12)

  • Flash::notice('Message')
public function delete()
{
    Flash::notice('Successfully banned user.');

    return redirect()->route('users.index');
}

For a basic flash instance of type info, just use the flash helper function: flash(Title, Message), (*13)

When using Laravel, this package creates flash session keys:, (*14)

Alerts, (*15)

  • sf_title containing the title of the flash message.
  • sf_message containing the actual flash message.
  • sf_level containing the level of flash message.
  • sf_persist only present when persist is used.

Notices, (*16)

  • sf_notice_message containing the flash notice message.

Within your views, include the flash view and the corresponding css and javascript files. You may modify the flash view and add more functionality to the flash instances by passing the properties described in Sweet Alert to the sflash instance:, (*17)

sflash({
    title: "{{ session('sf_title') }}",
    text: "{{ session('sf_message') }}",
    type: "{{ session('sf_level') }}",
    allowOutsideClick: true,
    confirmButtonText: "Okay Man",
    showConfirmButton: true
});

The Versions

26/07 2016

1.0.x-dev

1.0.9999999.9999999-dev

Flash messaging package for use with laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar SmoDav

laravel alert flash

26/07 2016

dev-master

9999999-dev

Flash messaging package for use with laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar SmoDav

laravel alert flash

26/07 2016

v1.0.1

1.0.1.0

Flash messaging package for use with laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar SmoDav

laravel alert flash

16/06 2016

v1.0.0

1.0.0.0

Flash messaging package for use with laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar SmoDav

laravel alert flash