| Package Data | |
|---|---|
| Maintainer Username: | iwanli |
| Maintainer Contact: | 709344897@qq.com (iwanli) |
| Package Create Date: | 2016-04-02 |
| Package Last Update: | 2016-04-02 |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-11-19 03:03:22 |
| Package Statistics | |
|---|---|
| Total Downloads: | 26 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 1 |
| Total Watchers: | 1 |
| Total Forks: | 0 |
| Total Open Issues: | 0 |
Begin by installing the package through Composer.
composer require lancewan/laravel-sweetalert=~1.0
Or add this code to composer.json file:
"lancewan/laravel5-sweetalert":"~1.0"
Once this operation is complete, simply add both the service provider and facade classes to your project's config/app.php file:
Lance\Sweet\SweetAlertServiceProvider::class,
'Sweet' => Lance\Sweet\Facade\Sweet::class,
Run php artisan vendor:publish
And that's it!
Usage is simple. Before redirecting to another page, simply call on Flash to set your desired Sweet message. There are a number of methods to assign different levels of priority (info, success, warning, and error).
Sweet::success($message, $title = '', $options = []);
Sweet::info($message, $title = '', $options = []);
Sweet::warning($message, $title = '', $options = []);
Sweet::error($message, $title = '', $options = []);
Just add this code to your blade template file:
{!! Sweet::render() !!}
set the sweetAlert options in config/sweet.php , available options => sweetAlert.js