Skip to content

Commit

Permalink
Updated to v2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
realrashid committed Jun 14, 2019
1 parent 06e8961 commit 53bb75c
Show file tree
Hide file tree
Showing 9 changed files with 247 additions and 77 deletions.
49 changes: 35 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,39 @@

All notable changes to `sweet-alert` will be documented in this file.

## v1.0 - 2017-09-02
- initial release
## v2.0 - 2019-06-14
- Upgraded SweetAlert2 to latest version
- Added width() helper method
- Added padding() helper method
- Added background() helper method
- Added animation() helper method
- Added focusConfirm() helper method
- Added focusCancel() helper method
- Added CDN Support
- Docs Updated
- Fix some bugs

## v1.0 - 2018-03-25
- Deprecated
Changes
```php
// From
public function toast($title = '', $type = '', $position = 'bottom-right'){...}
// To
public function toast($title = '', $type = ''){...}

## v1.1.1 - 2018-03-25
// set the default position in package config file or use the helper method position()
```

## v1.1.2 - 2019-03-29
- Upgraded SweetAlert2 to latest version
- Added hideCloseButton() helper method
- Added reverseButtons() helper method
- Added image() method
- Added addImage() helper method
- Added position() helper method
- Docs Updated
- Fix some bugs

## v1.1.1 - 2018-03-25
Added some new methods
- `alert() method`
- `alert()->success() method`
Expand All @@ -27,12 +52,8 @@ Added some new methods
- `toToast() helper method`
- `footer() helper method`

## v1.1.2 - 2019-03-29
- Upgraded SweetAlert2 to latest version
- Added hideCloseButton() helper method
- Added reverseButtons() helper method
- Added image() method
- Added addImage() helper method
- Added position() helper method
- Docs Updated
- Fix some bugs
## v1.0 - 2018-03-25
- Deprecated

## v1.0 - 2017-09-02
- initial release
19 changes: 8 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"name": "realrashid/sweet-alert",
"type": "library",
"description": "SweetAlert2 for Laravel 5.5.* by Rashid Ali",
"description": "A BEAUTIFUL, RESPONSIVE, CUSTOMIZABLE, ACCESSIBLE (WAI-ARIA) REPLACEMENT FOR JAVASCRIPT'S POPUP BOXES FOR LARAVEL BY RASHID ALI",
"keywords": [
"laravel",
"laravel-package",
"sweet-alert2",
"sweet",
"sweet-alert",
"notifier",
"toast",
"alert",
"noty"
],
Expand All @@ -24,20 +26,15 @@
"email": "[email protected]",
"issues": "https://github.com/realrashid/sweet-alert/issues",
"source": "https://github.com/realrashid/sweet-alert",
"docs": "https://github.com/realrashid/sweet-alert/README.md"
"docs": "https://realrashid.github.io/sweet-alert/"
},
"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"
"php": "~5.6|~7.0|~7.1.3",
"laravel/framework": "~5.4.0|~5.8.0|~5.9.0"
},
"autoload": {
"psr-4": {
"RealRashid\\SweetAlert\\": "src"
"RealRashid\\SweetAlert\\": "src/"
},
"files": [
"src/functions.php"
Expand Down
40 changes: 19 additions & 21 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
<p align="center">
<a href="https://realrashid.github.io/sweet-alert/">
<img src="https://github.com/sweetalert2/sweetalert2/raw/master/assets/swal2-logo.png" alt="SweetAlert2">
</a>
</p>
<p align="center">
A BEAUTIFUL, RESPONSIVE, CUSTOMIZABLE, ACCESSIBLE (WAI-ARIA) REPLACEMENT FOR JAVASCRIPT'S POPUP BOXES FOR LARAVEL
</p>
<p align="center">
<img src="https://raw.github.com/sweetalert2/sweetalert2/master/assets/sweetalert2.gif" width="562" height="388">
</p>

<p align="center">
<a href="https://packagist.org/packages/realrashid/sweet-alert" target="_blank"><img src="https://poser.pugx.org/realrashid/sweet-alert/d/total.svg" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/realrashid/sweet-alert" target="_blank"><img src="https://poser.pugx.org/realrashid/sweet-alert/v/stable.svg" alt="Latest Stable Version"></a>
Expand All @@ -7,32 +19,18 @@
<a href="https://packagist.org/packages/realrashid/sweet-alert" target="_blank"><img src="https://poser.pugx.org/realrashid/sweet-alert/license.svg" alt="License"></a>
</p>

# Introduction

A BEAUTIFUL, RESPONSIVE, CUSTOMIZABLE, ACCESSIBLE (WAI-ARIA) REPLACEMENT FOR JAVASCRIPT'S POPUP BOXES FOR LARAVEL

<p align="center">
<img src="https://raw.github.com/sweetalert2/sweetalert2/master/assets/sweetalert2.gif" width="562" height="388">
</p>
# Install

## Getting started
To get started with SweetAlert2, use Composer to add the package to your project's dependencies:

```
composer require realrashid/sweet-alert
```
<br>
<h3 align="center">
<a href="https://realrashid.github.io/sweet-alert" target="_blank">Documentation</a>
</h3>

## Backers

Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/sweet-alert#backer)]

<a href="https://opencollective.com/sweet-alert#backers" target="_blank"><img src="https://opencollective.com/sweet-alert/backers.svg?width=890"></a>

## Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/sweet-alert#sponsor)]

<a href="https://opencollective.com/sweet-alert/sponsor/0/website" target="_blank"><img src="https://opencollective.com/sweet-alert/sponsor/0/avatar.svg"></a>

<br>
## License

SweetAlert2 is open-sourced software licensed under the MIT License (MIT). Please see [License File](LICENSE.md) for more information.
Expand Down
30 changes: 30 additions & 0 deletions resources/views/alert.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@if(config('sweetalert.local') && !empty(config('sweetalert.cdn')))
<script src="{{ asset('vendor/sweetalert/sweetalert.all.js') }}"></script>
<script>
Swal.fire({
"title":"Warning!",
"html":`You can not use <b>cdn</b> and <b>local</b> together! <br />
You can only use <b>cdn</b> or <b>local</b>! <br />
If you want to use <b>cdn</b> goto <b>.env</b> and change <pre>SWEET_ALERT_LOCAL=false</pre>`,
"type":"warning",
"showConfirmButton":false,
"showCloseButton":true,
"allowEscapeKey":false,
"allowOutsideClick":false
});
</script>
@elseif(config('sweetalert.local'))
<script src="{{ asset('vendor/sweetalert/sweetalert.all.js') }}"></script>
@if (Session::has('alert.config'))
<script>
Swal.fire({!! Session::pull('alert.config') !!});
</script>
@endif
@elseif(!is_null(config('sweetalert.cdn')))
<script src="{{ config('sweetalert.cdn') }}"></script>
@if (Session::has('alert.config'))
<script>
Swal.fire({!! Session::pull('alert.config') !!});
</script>
@endif
@endif
16 changes: 9 additions & 7 deletions src/SweetAlertServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ public function boot()
{
$this->registerHelpers();

$this->loadViewsFrom(__DIR__ . '/Views', 'sweetalert');
$this->loadViewsFrom(__DIR__ . '/../resources/views', 'sweetalert');

$this->publishes(
[
__DIR__ . '/Views' => resource_path('views/vendor/sweetalert'),
]
);
$this->publishes([
__DIR__ . '/../resources/views' => resource_path('views/vendor/sweetalert')
], 'view');

$this->publishes([
__DIR__.'/config/sweetalert.php' => config_path('sweetalert.php')
], 'config');

$this->publishes([
__DIR__.'/js' => public_path('vendor/sweetalert'),
__DIR__.'/../resources/js' => public_path('vendor/sweetalert')
], 'public');
}

Expand Down
10 changes: 5 additions & 5 deletions src/ToSweetAlert.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,23 @@ public function handle($request, Closure $next)
}

if ($request->session()->has('toast_success')) {
alert()->toast($request->session()->get('toast_success'), 'success');
alert()->toast($request->session()->get('toast_success'), 'success')->middleware();
}

if ($request->session()->has('toast_info')) {
toast($request->session()->get('toast_info'), 'info');
toast($request->session()->get('toast_info'), 'info')->middleware();
}

if ($request->session()->has('toast_warning')) {
toast($request->session()->get('toast_warning'), 'warning');
toast($request->session()->get('toast_warning'), 'warning')->middleware();
}

if ($request->session()->has('toast_question')) {
toast($request->session()->get('toast_question'), 'question');
toast($request->session()->get('toast_question'), 'question')->middleware();
}

if ($request->session()->has('toast_error')) {
toast($request->session()->get('toast_error'), 'error');
toast($request->session()->get('toast_error'), 'error')->middleware();
}

return $next($request);
Expand Down
Loading

0 comments on commit 53bb75c

Please sign in to comment.