2017 © Pedro Peláez
 

library laravel-flash-foundation

Easy flash notifications in Laravel 5 for Foundation CSS 5

image

thomaswardiii/laravel-flash-foundation

Easy flash notifications in Laravel 5 for Foundation CSS 5

  • Wednesday, February 3, 2016
  • by thomaswardiii
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,424 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 290 Forks
  • 0 Open issues
  • 10 Versions
  • 40 % Grown

The README.md

Easy Flash Messages for Foundation

Overview

This is a package forked from the Laracasts Flash package to provide Foundation CSS friendly flash messages. It is meant to be a drop-in replacement for Laracasts Flash., (*1)

Installation

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

"require": {
    "thomaswardiii/laravel-flash-foundation": "~1.3"
}

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

'providers' => [
    'Laracasts\Flash\FlashServiceProvider'
];

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

'aliases' => [
    'Flash' => 'Laracasts\Flash\Flash'
];

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'))
    <div data-alert class="alert-box {{ Session::get('flash_notification.level') }}">
        {{ Session::get('flash_notification.message') }}
        <a href="#" class="close">&times;</a>
    </div>
@endif

Note that this package is optimized for use with ZURB Foundation., (*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="css/foundation.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

03/02 2016

dev-master

9999999-dev

Easy flash notifications in Laravel 5 for Foundation CSS 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Thomas Ward III

03/02 2016

1.3.5

1.3.5.0

Easy flash notifications in Laravel 5 for Foundation CSS 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Thomas Ward III

24/07 2015

1.3.4

1.3.4.0

Easy flash notifications in Laravel 5 for Foundation CSS 5

  Sources   Download

MIT

The Requires

 

The Development Requires

by Thomas Ward III

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