From f3f24cf38af576121588f85eb44cf933ba133351 Mon Sep 17 00:00:00 2001 From: Laracasts Date: Sun, 1 Feb 2015 14:53:38 -0500 Subject: [PATCH] Add note about flash helper function --- readme.md | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index a64b019..372eb70 100644 --- a/readme.md +++ b/readme.md @@ -6,11 +6,11 @@ First, pull in the package through Composer. ```js "require": { - "laracasts/flash": "~1.0" + "laracasts/flash": "~1.3" } ``` -And then, if using Laravel, include the service provider within `app/config/app.php`. +And then, if using Laravel 5, include the service provider within `app/config/app.php`. ```php 'providers' => [ @@ -47,11 +47,29 @@ You may also do: - `Flash::warning('Message')` - `Flash::overlay('Modal Message', 'Modal Title')` -Again, if using Laravel, this will set three keys in the session: +Again, if using Laravel, this will set a few keys in the session: - '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: + +``` +/** + * Destroy the user's session (logout). + * + * @return Response + */ +public function destroy() +{ + Auth::logout(); + + flash()->info('You have been logged out.'); + + return home(); +} +``` + With this message flashed to the session, you may now display it in your view(s). Maybe something like: ```html