Skip to content

Commit

Permalink
Updated README & removed flash notification rendering error
Browse files Browse the repository at this point in the history
  • Loading branch information
srmklive committed Oct 29, 2015
1 parent 9583928 commit be452a3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
Flash Notifications
===================

**This is an experimental release.!**

Laravel 5 flash notifications, originally developed after the Laracasts video tutorial : [Elegant Flash Messaging](https://laracasts.com/series/build-project-flyer-with-me/episodes/9).
Laravel 5 flash notifications, originally developed after the Laracasts video tutorial : [Elegant Flash Messaging](https://laracasts.com/series/build-project-flyer-with-me/episodes/9) which uses [SweetAlert](http://t4t5.github.io/sweetalert/).

Quick Installation
------------------
Expand All @@ -12,6 +10,11 @@ Run the following command to install the package through Composer.
composer require srmklive/flash-notifications
```

or in your composer.json file, add `"srmklive/flash-notifications": ">=0.1"` then run
```
composer update
```

Once this operation is complete, simply add both the service provider and facade classes to your project's `config/app.php` file:

#### Laravel 5.0.x
Expand All @@ -36,12 +39,14 @@ Srmklive\FlashAlert\FlashAlertServiceProvider::class,
'FlashAlert' => Srmklive\FlashAlert\Facades\FlashAlert::class,
```

#### Publish Configuration
#### Publish Configuration & Views
```
php artisan vendor:publish
```

Usage
-----
Usage is simple. Before redirecting to another page, simply call on `FlashAlert` to set your desired flash notification. There are a number of methods to assign different levels of priority (info, success, warning, and error).
Simply call on `FlashAlert` to set your desired flash notification. There are a number of methods to assign different levels of priority (info, success, warning, and error).

#### Success

Expand Down
2 changes: 1 addition & 1 deletion src/FlashAlertHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function warning($title, $message)
*/
public function error($title, $message)
{
$this->message($title, $message, 'danger');
$this->message($title, $message, 'error');
}

/**
Expand Down
20 changes: 9 additions & 11 deletions views/alert.blade.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
@if(session()->has('flashalert'))

@section('styles')
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css" />
@endsection


@if(session()->has('flashalert'))

@section('scripts')
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js"></script>
<script type="text/javascript">
swal({
title: "",
text: "{{{session()->get('flashalert.message')}}}",
type: "{{{session()->get('flashalert.level')}}}",
timer: {{{config('flashalert.hide_timer')}}},
showConfirmButton: {{{config('flashalert.show_confirmation_button')}}}
});
<script>
swal({
title: "{{session('flashalert.title')}}",
text: "{{session('flashalert.message')}}",
type: "{{session('flashalert.level')}}",
timer: "{{config('flashalert.hide_timer')}}",
showConfirmButton: "{{config('flashalert.show_confirmation_button')}}"
});
</script>
@endsection

Expand Down

0 comments on commit be452a3

Please sign in to comment.