Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lancewan/laravel5-sweetalert
SweetAlert.js for laravel5.2
https://github.com/lancewan/laravel5-sweetalert
Last synced: 27 days ago
JSON representation
SweetAlert.js for laravel5.2
- Host: GitHub
- URL: https://github.com/lancewan/laravel5-sweetalert
- Owner: lanceWan
- Created: 2016-04-02T06:18:23.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-04-02T13:50:17.000Z (almost 9 years ago)
- Last Synced: 2024-12-08T13:38:38.290Z (about 2 months ago)
- Language: PHP
- Size: 6.84 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# [SweetAlert.js](http://t4t5.github.io/sweetalert/) for laravel5
## Quick Installation
Begin by installing the package through Composer.
```php
composer require lancewan/laravel-sweetalert=~1.0
```
**Or** add this code to `composer.json` file:
```php
"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:### Service Provider
```php
Lance\Sweet\SweetAlertServiceProvider::class,
```### Facade
```php
'Sweet' => Lance\Sweet\Facade\Sweet::class,
```**Run** `php artisan vendor:publish`
And that's it!
## Usage
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).
### Success
```php
Sweet::success($message, $title = '', $options = []);
```### Info
```php
Sweet::info($message, $title = '', $options = []);
```### Warning
```php
Sweet::warning($message, $title = '', $options = []);
```### Error
```php
Sweet::error($message, $title = '', $options = []);
```### Rendering
Just add this code to your blade template file:```php
{!! Sweet::render() !!}
```## Config
set the sweetAlert options in **config/sweet.php** , available options => [sweetAlert.js](http://t4t5.github.io/sweetalert/)