Package Data | |
---|---|
Maintainer Username: | srmklive |
Maintainer Contact: | srmk@outlook.com (Raza Mehdi) |
Package Create Date: | 2015-10-29 |
Package Last Update: | 2017-09-01 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-18 03:03:56 |
Package Statistics | |
---|---|
Total Downloads: | 2,410 |
Monthly Downloads: | 1 |
Daily Downloads: | 0 |
Total Stars: | 7 |
Total Watchers: | 3 |
Total Forks: | 4 |
Total Open Issues: | 0 |
Laravel 5 flash notifications, originally developed after the Laracasts video tutorial : Elegant Flash Messaging which uses SweetAlert.
Run the following command to install the package through Composer.
composer require srmklive/flash-notifications
or in your composer.json file, add "srmklive/flash-notifications": ">=0.1"
then run
composer update
Once this operation is complete, simply add both the service provider and facade classes to your project's config/app.php
file:
'Srmklive\FlashAlert\FlashAlertServiceProvider', // Laravel 5.0
Srmklive\FlashAlert\FlashAlertServiceProvider::class, // Laravel 5.1 or greater
'FlashAlert' => 'Srmklive\FlashAlert\Facades\FlashAlert', // Laravel 5.0
'FlashAlert' => Srmklive\FlashAlert\Facades\FlashAlert::class, // Laravel 5.1 or greater
php artisan vendor:publish
Simply call on FlashAlert
to set your desired flash notification. There are a number of methods to assign different levels of priority (info, success, warning, and error).
FlashAlert::success('Success', 'This is a success message.');
FlashAlert::info('Info', 'This is an info message.');
FlashAlert::warning('Warning', 'This is a warning message.');
FlashAlert::error('Error', 'This is an error message.');
To render your flash notifications in your view, simply include the view partial in your master layout. Also add @yield('styles') & yield('scripts') in your master layout:
@include('flashalert::alert')