Skip to content

Commit

Permalink
Fixed a typo in readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
uziel-bueno committed Oct 24, 2017
1 parent 6ae9e86 commit c085e50
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
17 changes: 5 additions & 12 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,11 @@

First, pull in the package through Composer.

```javascript
"require": {
"uxweb/sweet-alert": "~1.4"
}
```

or faster using the terminal:
```
composer require uxweb/sweet-alert
```

If using Laravel 5, include the service provider within `config/app.php`.
If using laravel < 5.5 include the service provider within `config/app.php`.

```php
'providers' => [
Expand All @@ -42,7 +35,7 @@ Finally, you need to get the Sweet Alert library, you can so by:

Download the .js and .css from the [website](http://t4t5.github.io/sweetalert/)

If you are using Laravel Elixir for your front-end workflow, add swet alert with [yarn](https://yarnpkg.com/) or nmp
If you are using Laravel Elixir for your front-end workflow, add sweet alert with [yarn](https://yarnpkg.com/) or nmp

using Yarn:
```php
Expand Down Expand Up @@ -119,7 +112,7 @@ public function destroy()

For a general information alert, just do: `alert('Some message');` (same as `alert()->message('Some message');`).

### With the Middleware
### With the Middleware
#### Using middleware groups
First register the middleware in web middleware groups by simply add the middleware class `UxWeb\SweetAlert\ConvertMessagesIntoSweetAlert::class` into the $middlewareGroups of your app/Http/Kernel.php class:

Expand Down Expand Up @@ -155,13 +148,13 @@ protected $routeMiddleware = [
Next step, Within your controllers, set your return message (using `with()`), send the proper message and proper type

```PHP
return redirect('dashboard')->with('success', 'Profile updated!');
return redirect('dashboard')->with('success', 'Profile updated!');
```

or

```PHP
return redirect()->back()->with('errors', 'Profile updated!');
return redirect()->back()->with('errors', 'Profile updated!');
```

> **NOTE**: When using the middleware it will make an alert to display if detects any of the following keys flashed into the session: `errors`, `success`, `warning`, `info`, `message`, `basic`.
Expand Down
2 changes: 1 addition & 1 deletion src/SweetAlert/SweetAlertServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function boot()
$this->loadViewsFrom(__DIR__.'/../views', 'sweet');

$this->publishes([
__DIR__.'/../views' => base_path('resources/views/vendor/sweet'),
__DIR__.'/../views' => base_path('resources/views/vendor/sweet'),
__DIR__.'/../config/sweet-alert.php' => config_path('sweet-alert.php'),
]);
}
Expand Down

0 comments on commit c085e50

Please sign in to comment.