diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..4c65abb
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,27 @@
+# Changelog
+
+All notable changes to `` will be documented in this file.
+
+Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
+
+## [v1.1] - 2018-03-25
+
+### Added
+- `alert() method`
+- `alert()->success() method`
+- `alert()->info() method`
+- `alert()->wanring() method`
+- `alert()->question() method`
+- `alert()->error() method`
+- `alert()->html() method`
+- `toast() method`
+- `showConfirmButton() method`
+- `showCloseButton() method`
+- `showCancelButton() method`
+- `persistent() method`
+- `autoClose() method`
+- `toToast() method`
+- `footer() method`
+
+### Deprecated
+- v1.0
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..4810738
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,9 @@
+The Laravel SweetAlert2 code of conduct is derived from the Ruby code of conduct. Any violations of the code of conduct may be reported to Rashid Ali (realrashid05@gmail.com).
+
+- Participants will be tolerant of opposing views.
+
+- Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
+
+- When interpreting the words and actions of others, participants should always assume good intentions.
+
+- Behavior which can be reasonably considered harassment will not be tolerated.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..8c179e8
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,25 @@
+If you would like to contribute enhancements or fixes, please do the following:
+
+1. Create Laravel Project via Composer or Laravel Installer.
+
+2. In the project root directory create folder named as packages.
+
+3. Fork the `sweet-alert` repository and clone it in packages.
+
+4. Now goto your `composer.json` file and add this `"RealRashid\\SweetAlert\\": "packages/realrashid/sweet-alert/src"` line under `autoload` `psr-4` section
+
+like below
+
+``` json
+"autoload": {
+ "classmap": [
+ "database/seeds",
+ "database/factories"
+ ],
+ "psr-4": {
+ "App\\": "app/",
+ "RealRashid\\SweetAlert\\": "packages/realrashid/sweet-alert/src"
+ }
+},
+
+```
diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md
new file mode 100644
index 0000000..437bb8f
--- /dev/null
+++ b/ISSUE_TEMPLATE.md
@@ -0,0 +1,25 @@
+
+
+## Detailed description
+
+Provide a detailed description of the change or addition you are proposing.
+
+Make it clear if the issue is a bug, an enhancement or just a question.
+
+## Context
+
+Why is this change important to you? How would you use it?
+
+How can it benefit other users?
+
+## Possible implementation
+
+Not obligatory, but suggest an idea for implementing addition or change.
+
+## Your environment
+
+Include as many relevant details about the environment you experienced the bug in and how to reproduce it.
+
+* Version used (e.g. Laravel v5.6, SweetAlert2 v7.18.0):
+* Operating system and version (e.g. Ubuntu 16.04, Windows 7):
+* Link to your project:
diff --git a/LICENSE.md b/LICENSE.md
new file mode 100644
index 0000000..bd8ac34
--- /dev/null
+++ b/LICENSE.md
@@ -0,0 +1,21 @@
+# The MIT License (MIT)
+
+Copyright (c) 2018 Rashid Ali
+
+> Permission is hereby granted, free of charge, to any person obtaining a copy
+> of this software and associated documentation files (the "Software"), to deal
+> in the Software without restriction, including without limitation the rights
+> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+> copies of the Software, and to permit persons to whom the Software is
+> furnished to do so, subject to the following conditions:
+>
+> The above copyright notice and this permission notice shall be included in
+> all copies or substantial portions of the Software.
+>
+> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+> THE SOFTWARE.
diff --git a/composer.json b/composer.json
index b42030c..fcc4fc4 100644
--- a/composer.json
+++ b/composer.json
@@ -1,39 +1,59 @@
{
- "name": "realrashid/sweet-alert",
- "description": "SweetAlert2 for Laravel 5.x by Rashid Ali",
- "authors": [{
- "name": "Rashid Ali",
- "email": "realrashid05@gmail.com"
- }],
- "license": "MIT",
- "require": {
- "php": ">=5.4.0",
- "illuminate/support": "~5.4"
- },
- "autoload": {
- "psr-0": {
- "RealRashid\\SweetAlert\\": "src/"
+ "name": "realrashid/sweet-alert",
+ "type": "library",
+ "description": "SweetAlert2 for Laravel 5.5.* by Rashid Ali",
+ "keywords": [
+ "laravel",
+ "sweet-alert2",
+ "sweet",
+ "notifier",
+ "alert",
+ "noty"
+ ],
+ "homepage": "https://github.com/realrashid/sweet-alert",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Rashid Ali",
+ "email": "realrashid05@gmail.com",
+ "homepage": "https://realrashid.com",
+ "role": "Developer"
+ }
+ ],
+ "support": {
+ "email": "realrashid05@gmail.com",
+ "issues": "https://github.com/realrashid/sweet-alert/issues",
+ "source": "https://github.com/realrashid/sweet-alert",
+ "docs": "https://github.com/realrashid/sweet-alert/README.md"
+ },
+ "require": {
+ "illuminate/support": "~5.1",
+ "illuminate/session": "~5.1",
+ "php": "~5.6|~7.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": ">=5.4.3",
+ "squizlabs/php_codesniffer": "^2.3"
},
- "files": [
- "src/RealRashid/SweetAlert/functions.php"
- ]
- },
- "extra": {
- "branch-alias": {
- "dev-master": "3.0-dev"
+ "autoload": {
+ "psr-4": {
+ "RealRashid\\SweetAlert\\": "src"
},
+ "files": [
+ "src/functions.php"
+ ]
+ },
+ "extra": {
"laravel": {
"providers": [
"RealRashid\\SweetAlert\\SweetAlertServiceProvider"
],
"aliases": {
- "Alert": "RealRashid\\SweetAlert\\Facades\\Alert::class"
+ "Alert": "RealRashid\\SweetAlert\\Facades"
}
}
},
"config": {
"sort-packages": true
- },
- "minimum-stability": "dev",
- "prefer-stable": true
+ }
}
diff --git a/imgs/alert/ErrorAlert.png b/imgs/alert/ErrorAlert.png
new file mode 100644
index 0000000..80dec84
Binary files /dev/null and b/imgs/alert/ErrorAlert.png differ
diff --git a/imgs/alert/HtmlAlert.png b/imgs/alert/HtmlAlert.png
new file mode 100644
index 0000000..77352f1
Binary files /dev/null and b/imgs/alert/HtmlAlert.png differ
diff --git a/imgs/alert/InfoAlert.png b/imgs/alert/InfoAlert.png
new file mode 100644
index 0000000..b1bbc10
Binary files /dev/null and b/imgs/alert/InfoAlert.png differ
diff --git a/imgs/alert/QuestionAlert.png b/imgs/alert/QuestionAlert.png
new file mode 100644
index 0000000..b3126b7
Binary files /dev/null and b/imgs/alert/QuestionAlert.png differ
diff --git a/imgs/alert/SuccessAlert.png b/imgs/alert/SuccessAlert.png
new file mode 100644
index 0000000..ceeaed2
Binary files /dev/null and b/imgs/alert/SuccessAlert.png differ
diff --git a/imgs/alert/SuccessAlert1.png b/imgs/alert/SuccessAlert1.png
new file mode 100644
index 0000000..e3f2d6b
Binary files /dev/null and b/imgs/alert/SuccessAlert1.png differ
diff --git a/imgs/alert/SweetAlert.png b/imgs/alert/SweetAlert.png
new file mode 100644
index 0000000..4852a9b
Binary files /dev/null and b/imgs/alert/SweetAlert.png differ
diff --git a/imgs/alert/WarningAlert.png b/imgs/alert/WarningAlert.png
new file mode 100644
index 0000000..fe226b7
Binary files /dev/null and b/imgs/alert/WarningAlert.png differ
diff --git a/imgs/auto-close.PNG b/imgs/auto-close.PNG
deleted file mode 100644
index 57da7cc..0000000
Binary files a/imgs/auto-close.PNG and /dev/null differ
diff --git a/imgs/basic-msg.PNG b/imgs/basic-msg.PNG
deleted file mode 100644
index e83796c..0000000
Binary files a/imgs/basic-msg.PNG and /dev/null differ
diff --git a/imgs/delete.PNG b/imgs/delete.PNG
deleted file mode 100644
index 03b4848..0000000
Binary files a/imgs/delete.PNG and /dev/null differ
diff --git a/imgs/deleted.PNG b/imgs/deleted.PNG
deleted file mode 100644
index 9a18214..0000000
Binary files a/imgs/deleted.PNG and /dev/null differ
diff --git a/imgs/html-elements.PNG b/imgs/html-elements.PNG
deleted file mode 100644
index afa986d..0000000
Binary files a/imgs/html-elements.PNG and /dev/null differ
diff --git a/imgs/intro.PNG b/imgs/intro.PNG
deleted file mode 100644
index 0611f29..0000000
Binary files a/imgs/intro.PNG and /dev/null differ
diff --git a/imgs/modal-with-image.PNG b/imgs/modal-with-image.PNG
deleted file mode 100644
index b532509..0000000
Binary files a/imgs/modal-with-image.PNG and /dev/null differ
diff --git a/imgs/rashid-coming-soon.PNG b/imgs/rashid-coming-soon.PNG
deleted file mode 100644
index 2b2c8f1..0000000
Binary files a/imgs/rashid-coming-soon.PNG and /dev/null differ
diff --git a/imgs/toast/ErrorToast.png b/imgs/toast/ErrorToast.png
new file mode 100644
index 0000000..d4c6e55
Binary files /dev/null and b/imgs/toast/ErrorToast.png differ
diff --git a/imgs/toast/InfoToast.png b/imgs/toast/InfoToast.png
new file mode 100644
index 0000000..47c581c
Binary files /dev/null and b/imgs/toast/InfoToast.png differ
diff --git a/imgs/toast/QuestionToast.png b/imgs/toast/QuestionToast.png
new file mode 100644
index 0000000..41d1c77
Binary files /dev/null and b/imgs/toast/QuestionToast.png differ
diff --git a/imgs/toast/SuccessToast.png b/imgs/toast/SuccessToast.png
new file mode 100644
index 0000000..7e02afe
Binary files /dev/null and b/imgs/toast/SuccessToast.png differ
diff --git a/imgs/toast/SuccessToast1.png b/imgs/toast/SuccessToast1.png
new file mode 100644
index 0000000..57c4e2e
Binary files /dev/null and b/imgs/toast/SuccessToast1.png differ
diff --git a/imgs/toast/SweetToast.png b/imgs/toast/SweetToast.png
new file mode 100644
index 0000000..7f0c7b7
Binary files /dev/null and b/imgs/toast/SweetToast.png differ
diff --git a/imgs/toast/WarningToast.png b/imgs/toast/WarningToast.png
new file mode 100644
index 0000000..c02da67
Binary files /dev/null and b/imgs/toast/WarningToast.png differ
diff --git a/imgs/types/error.png b/imgs/types/error.png
deleted file mode 100644
index 1428f9e..0000000
Binary files a/imgs/types/error.png and /dev/null differ
diff --git a/imgs/types/info.png b/imgs/types/info.png
deleted file mode 100644
index 6b3ab2a..0000000
Binary files a/imgs/types/info.png and /dev/null differ
diff --git a/imgs/types/question.png b/imgs/types/question.png
deleted file mode 100644
index 7db665f..0000000
Binary files a/imgs/types/question.png and /dev/null differ
diff --git a/imgs/types/success.png b/imgs/types/success.png
deleted file mode 100644
index a9ada96..0000000
Binary files a/imgs/types/success.png and /dev/null differ
diff --git a/imgs/types/warning.png b/imgs/types/warning.png
deleted file mode 100644
index 3be5765..0000000
Binary files a/imgs/types/warning.png and /dev/null differ
diff --git a/readme.md b/readme.md
index a000aae..183c686 100644
--- a/readme.md
+++ b/readme.md
@@ -2,8 +2,12 @@
+
+
+> note: if you are using sweet-alert v1.0 you can get READMEfor v1.0 from [here](https://github.com/realrashid/sweet-alert/blob/1.0/readme.md)
+
# Introduction
A BEAUTIFUL, RESPONSIVE, CUSTOMIZABLE, ACCESSIBLE (WAI-ARIA) REPLACEMENT FOR JAVASCRIPT'S POPUP BOXES
@@ -11,12 +15,12 @@ A BEAUTIFUL, RESPONSIVE, CUSTOMIZABLE, ACCESSIBLE (WAI-ARIA) REPLACEMENT FOR JAV
ZERO DEPENDENCIES
-
+
# Install
-To get started with SweetAlert, use Composer to add the package to your project's dependencies:
+To get started with SweetAlert2, use Composer to add the package to your project's dependencies:
```
composer require realrashid/sweet-alert
@@ -24,7 +28,11 @@ composer require realrashid/sweet-alert
## Configuration
-After installing the SweetAlert library, register the `RealRashid\SweetAlert\SweetAlertServiceProvider::class` in your `config/app.php` configuration file:
+> Note, Optional in `Laravel 5.5 or +`
+
+After installing the sweet-alert package, register the
+`RealRashid\SweetAlert\SweetAlertServiceProvider::class`
+in your `config/app.php` configuration file:
```php
'providers' => [
@@ -34,292 +42,326 @@ After installing the SweetAlert library, register the `RealRashid\SweetAlert\Swe
],
```
-Also, add the `SweetAlert` facade to the `aliases` array in your `app` configuration file:
+Also, add the `Alert` facade to the `aliases` array in your `app` configuration file:
```php
'Alert' => RealRashid\SweetAlert\Facades\Alert::class,
```
-> Note, there is a alert() function available, so unless you really want to use the Facade, there's no need to include it.
-
-### Import SweetAlert Libraries
+## Import SweetAlert 2 Library
-in your views
-
-```css
-
-```
+in your master layout
```javascript
-
+
```
-# Usage
+and include sweetalert view
-## Basic
+`@include('sweetalert::alert')`
-From your application, call the `flash` method with a message and type.
+> Include the sweetalert view below the cdn link in your layout!
-```php
-alert()->flash('Welcome back!', 'success');
-```
+## Usage
-Within a view, you can now check if a flash message exists and output it.
+#### Using Facade
-```php
-@if (alert()->ready())
-
-@endif
-```
+Import Alert Facade first!
-## Options
+`use RealRashid\SweetAlert\Facades\Alert;` or
+`Use Alert;` in your controller
-You can pass additional options to the `flash` method, which are then easily accessible within your view.
+* `Alert::alert('Title', 'Message', 'Type');`
+* `Alert::success('Success Title', 'Success Message');`
+* `Alert::info('Info Title', 'Info Message');`
+* `Alert::warning('Warning Title', 'Warning Message');`
+* `Alert::error('Error Title', 'Error Message');`
+* `Alert::question('Question Title', 'Question Message');`
+* `Alert::html('Html Title', 'Html Code', 'Type');`
+* `Alert::toast('Toast Message', 'Toast Type', 'Toast Position');`
-```php
-alert()->flash(title, modal type, options[]);
-```
+### Using the helper function
-# Alert Types
+#### Alert
-A basic message!
+* `alert('Title','Lorem Lorem Lorem', 'success');`
-in controller
+* `alert()->success('Title','Lorem Lorem Lorem');`
-```php
-alert()->flash('Welcome to Laravel SweetAlert By Rashid Ali!');
-```
+* `alert()->info('Title','Lorem Lorem Lorem');`
-in view
+* `alert()->warning('Title','Lorem Lorem Lorem');`
-```javascript
-@if (alert()->ready())
-
-@endif
+* `alert()->question('Title','Lorem Lorem Lorem');`
+
+* `alert()->error('Title','Lorem Lorem Lorem');`
+
+* `alert()->html('HTMLexample'," You can use bold text, links and other HTML tags ",'success');`
+
+#### Toast
+
+* `toast('Your Post as been submited!','success','top-right');`
+
+### Demo
+
+#### Success Alert
+
+```php
+/**
+ * Store a newly created resource in storage.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @return \Illuminate\Http\Response
+*/
+public function store(PostRequest $request)
+{
+ $post = Post::create($request->all());
+
+ if ($post) {
+ alert()->success('Post Created', 'Successfully');
+ return redirect()->route('posts.index');
+ }
+}
```
-Custom HTML description and buttons!
+##### Info Alert
-in controller
-
-```php
-alert()->flash('HTMLexample', 'info',[
- 'html' => "You can use bold text, \
- links \
- and other HTML tags",
- 'showCloseButton' => true
- ]);
+``` php
+alert()->info('InfoAlert','Lorem ipsum dolor sit amet.');
```
-in view
+
+
+
-```javascript
-@if (alert()->ready())
-
-@endif
+##### Warning Alert
+
+``` php
+alert()->warning('WarningAlert','Lorem ipsum dolor sit amet.');
```
-
+
-A warning message, with a function attached to the "Confirm"-buttons!
+##### Question Alert
-in controller
-
-```php
-alert()->flash('Are you sure?', 'warning',[
- 'text' => 'You won\'t be able to revert this!',
- 'showCancelButton' => true,
- 'confirmButtonColor' => '#3085d6',
- 'cancelButtonColor' => '#d33',
- 'confirmButtonText' => 'Yes, delete it!',
- // if user clicked Yes, delete it!
- // then this will run
- 'deleted' => 'Deleted!',
- 'msg' => 'Your file has been deleted.',
- 'type' => 'success'
- ]);
+``` php
+alert()->question('QuestionAlert','Lorem ipsum dolor sit amet.');
```
-in view
+
+
+
+
+##### Error Alert
-```javascript
-@if (alert()->ready())
-
-@endif
+``` php
+alert()->error('ErrorAlert','Lorem ipsum dolor sit amet.');
```
-
+
-After clicked Yes, delete it!
+##### Html Alert
+
+``` php
+alert()->html('HTMLexample',"
+ You can use bold text,
+ links
+ and other HTML tags
+",'success');
+```
-
+
+#### Toast
-A message with a custom image and CSS animation disabled!
+##### Success Toast
-in controller
+``` php
+toast('Success Toast','success','top-right');
+```
-```php
-alert()->flash('Sweet!', 'success',[
- 'text' => 'Modal with a custom image.',
- 'imageUrl' => 'https://unsplash.it/400/200',
- 'imageWidth' => 400,
- 'imageHeight' => 200,
- 'animation' => false
- ]);
+
-> The above examples uses SweetAlert, but the flexibily of alert means you can easily use it with any JavaScript alert solution.
+##### Question Toast
-## Modal Types
+``` php
+toast('Question Toast','question','top-right');
+```
-`success` | `error` | `warning` | `info` | `question`
----------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | -----------------------------------------------------------------------------------
- |  |  |  | 
+
+
+
-# Issues and Contribution
+##### Error Toast
-Just submit an issue or pull request through GitHub. Thanks!
+``` php
+toast('Error Toast','error','top-right');
+```
-## Connect with Me
+
+
+
-- Website: http://realrashid.com
-- Email: realrashid05@gmail.com
-- Twitter: http://twitter.com/rashidali05
-- Facebook: https://www.facebook.com/rashidali05
-- GitHub: https://github.com/realrashid
+## Contributing
+Please see [CONTRIBUTING](https://github.com/realrashid/sweet-alert/blob/master/CONTRIBUTING.md) and [CODE_OF_CONDUCT](https://github.com/realrashid/sweet-alert/blob/master/CODE_OF_CONDUCT.md) for details.
+## Credits
+* [SweetAlert2](https://github.com/sweetalert2/sweetalert2)
-# License
+## Connect with Me
-SweetAlert is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)
+* Website: http://realrashid.com
+* Email: realrashid05@gmail.com
+* Twitter: http://twitter.com/rashidali05
+* Facebook: https://www.facebook.com/rashidali05
+* GitHub: https://github.com/realrashid
-
Made :heart: with Pakistan
+## License
+SweetAlert2 is open-sourced software licensed under the MIT License (MIT). Please see [License File](LICENSE.md) for more information.
+