dev-master
9999999-devNotifications
MIT
The Requires
- php >=5.4.0
- illuminate/support ~5.0
The Development Requires
1.0.0
1.0.0.0Notifications
MIT
The Requires
- php >=5.4.0
- illuminate/support ~5.0
The Development Requires
Notifications
First, pull in the package through Composer., (*1)
"require": { "arthurguy/notifications": "~1.0" }
And then, if using Laravel 5, include the service provider within app/config/app.php
., (*2)
'providers' => [ 'ArthurGuy\Notifications\NotificationServiceProvider' ];
And, for convenience, add a facade alias to this same file at the bottom:, (*3)
'aliases' => [ 'Flash' => 'ArthurGuy\Notifications\NotificationFacade' ];
Within your controllers, before you perform a redirect..., (*4)
public function store() { Notification::message('Welcome Aboard!'); return Redirect::home(); }
You may also do:, (*5)
Notification::info('Message')
Notification::success('Message')
Notification::error('Message')
Notification::warning('Message')
Again, if using Laravel, this will set a few keys in the session:, (*6)
Alternatively, again, if you're using Laravel, you may reference the flash()
helper function, instead of the facade. Here's an example:, (*7)
/** * Destroy the user's session (logout). * * @return Response */ public function destroy() { Auth::logout(); notification()->success('You have been logged out.'); return home(); }
Or, for a general information flash, just do: notification('Some message');
., (*8)
With this message flashed to the session, you may now display it in your view(s). Maybe something like:, (*9)
@if (Session::has('flash_notification.message')){{ Session::get('flash_notification.message') }}@endif
Notifications
MIT
Notifications
MIT