2017 © Pedro Peláez
 

library toastr_flash

Bootstrap and toastr Easy flash notifications

image

xuzh/toastr_flash

Bootstrap and toastr Easy flash notifications

  • Thursday, June 16, 2016
  • by xuzh86
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 290 Forks
  • 0 Open issues
  • 12 Versions
  • 0 % Grown

The README.md

Easy Flash Messages

Installation

First, pull in the package through Composer., (*1)

Run composer require xuzh/toastr_flash, (*2)

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

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

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

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

Usage

Within your controllers, before you perform a redirect..., (*5)

public function store()
{
    Flash::message('Welcome Aboard!');

    return Redirect::home();
}

You may also do:, (*6)

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

Again, if using Laravel, this will set a few keys in the session:, (*7)

  • 'flash_notification.message' - The message you're flashing
  • 'flash_notification.level' - A string that represents the type of notification (good for applying HTML class names)

Alternatively, again, if you're using Laravel, you may reference the flash() helper function, instead of the facade. Here's an example:, (*8)

/**
 * Destroy the user's session (logout).
 *
 * @return Response
 */
public function destroy()
{
    Auth::logout();

    flash()->success('You have been logged out.');

    return home();
}

Or, for a general information flash, just do: flash('Some message');., (*9)

With this message flashed to the session, you may now display it in your view(s). Maybe something like:, (*10)

@if (Session::has('flash_notification.message'))


{{ Session::get('flash_notification.message') }}
@endif

Note that this package is optimized for use with Twitter Bootstrap., (*11)

Because flash messages and overlays are so common, if you want, you may use (or modify) the views that are included with this package. Simply append to your layout view:, (*12)

@include('flash::message')

Example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
</head>
<body>



@include('flash::message')

Welcome to my website..., (*13)

</body> </html>

If you need to modify the flash message partials, you can run:, (*14)

php artisan vendor:publish

The two package views will now be located in the app/views/packages/laracasts/flash/ directory., (*15)

Flash::message('Welcome aboard!');

return Redirect::home();

https://dl.dropboxusercontent.com/u/774859/GitHub-Repos/flash/message.png, (*16)

Flash::error('Sorry! Please try again.');

return Redirect::home();

https://dl.dropboxusercontent.com/u/774859/GitHub-Repos/flash/error.png, (*17)

Flash::overlay('You are now a Laracasts member!');

return Redirect::home();

https://dl.dropboxusercontent.com/u/774859/GitHub-Repos/flash/overlay.png, (*18)

Learn exactly how to build this very package on Laracasts!, (*19)

The Versions

16/06 2016

dev-master

9999999-dev

Bootstrap and toastr Easy flash notifications

  Sources   Download

MIT

The Requires

 

The Development Requires

by xuzh

16/06 2016

2.0.2

2.0.2.0

Bootstrap and toastr Easy flash notifications

  Sources   Download

MIT

The Requires

 

The Development Requires

by xuzh

16/06 2016

2.0.1

2.0.1.0

Easy flash notifications

  Sources   Download

MIT

The Requires

 

The Development Requires

14/03 2016

2.0.0

2.0.0.0

Easy flash notifications

  Sources   Download

MIT

The Requires

 

The Development Requires

22/12 2015

1.3.4

1.3.4.0

Easy flash notifications

  Sources   Download

MIT

The Requires

 

The Development Requires

01/02 2015

1.3.3

1.3.3.0

Easy flash notifications

  Sources   Download

MIT

The Requires

 

The Development Requires

01/02 2015

1.3.2

1.3.2.0

Easy flash notifications

  Sources   Download

MIT

The Requires

 

The Development Requires

01/02 2015

1.3.1

1.3.1.0

Easy flash notifications

  Sources   Download

MIT

The Requires

 

The Development Requires

13/09 2014

1.3

1.3.0.0

Easy flash notifications

  Sources   Download

MIT

The Requires

 

The Development Requires

04/08 2014

1.2

1.2.0.0

Easy flash notifications

  Sources   Download

MIT

The Requires

 

The Development Requires

25/07 2014

1.1

1.1.0.0

Easy flash notifications

  Sources   Download

MIT

The Requires

 

The Development Requires

30/06 2014

1.0

1.0.0.0

Easy flash notifications

  Sources   Download

MIT

The Requires

 

The Development Requires