diff --git a/app/Http/Controllers/Invoices/DraftsController.php b/app/Http/Controllers/Invoices/DraftsController.php index 4c1073f..bb3e68e 100644 --- a/app/Http/Controllers/Invoices/DraftsController.php +++ b/app/Http/Controllers/Invoices/DraftsController.php @@ -2,12 +2,12 @@ namespace App\Http\Controllers\Invoices; +use Illuminate\Http\Request; use App\Entities\Projects\Project; use App\Http\Controllers\Controller; +use App\Services\InvoiceDrafts\Item; use App\Services\InvoiceDrafts\InvoiceDraft; use App\Services\InvoiceDrafts\InvoiceDraftCollection; -use App\Services\InvoiceDrafts\Item; -use Illuminate\Http\Request; /** * Invoice Drafts Controller. @@ -143,7 +143,7 @@ class DraftsController extends Controller $draft = $this->draftCollection->updateDraftAttributes($draftKey, $invoiceData); if ($draft->getItemsCount() == 0) { - flash(trans('invoice.item_list_empty'), 'warning')->important(); + flash(trans('invoice.item_list_empty'), 'warning'); return redirect()->route('invoice-drafts.show', [$draftKey]); } @@ -160,7 +160,7 @@ class DraftsController extends Controller $invoice = $draft->store(); $draft->destroy(); - flash(trans('invoice.created', ['number' => $invoice->number]), 'success')->important(); + flash(trans('invoice.created', ['number' => $invoice->number]), 'success'); return redirect()->route('invoices.show', $invoice->number); } diff --git a/app/helpers.php b/app/helpers.php index ee78f22..3c8044b 100755 --- a/app/helpers.php +++ b/app/helpers.php @@ -200,3 +200,21 @@ function monthDateArray($year, $month) return $dates; } + +/** + * Function helper to add flash notification. + * + * @param null|string $message The flashed message. + * @param string $level Level/type of message + * + * @return void + */ +function flash($message = null, $level = 'info') +{ + $session = app('session'); + + if (!is_null($message)) { + $session->flash('flash_notification.message', $message); + $session->flash('flash_notification.level', $level); + } +} diff --git a/composer.json b/composer.json index 5607738..b25ba90 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,6 @@ "php": ">=7.0.0", "backup-manager/laravel": "^1.2", "guzzlehttp/guzzle": "^6.3", - "laracasts/flash": "~2", "laracasts/presenter": "^0.2.1", "laravel/framework": "5.5.*", "luthfi/formfield": "^0.2.7", diff --git a/composer.lock b/composer.lock index 56b696a..fc9ec16 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "fbbbce942b136e9658949c3791b65695", + "content-hash": "ce794c0f3010842685536b7dc4c2b7f2", "packages": [ { "name": "backup-manager/backup-manager", @@ -541,49 +541,6 @@ "time": "2017-03-20T17:10:46+00:00" }, { - "name": "laracasts/flash", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/laracasts/flash.git", - "reference": "03eec812fd6ae948664ff51b4320785f6d15ee5d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laracasts/flash/zipball/03eec812fd6ae948664ff51b4320785f6d15ee5d", - "reference": "03eec812fd6ae948664ff51b4320785f6d15ee5d", - "shasum": "" - }, - "require": { - "illuminate/support": "~5.0", - "php": ">=5.4.0" - }, - "require-dev": { - "mockery/mockery": "dev-master" - }, - "type": "library", - "autoload": { - "psr-0": { - "Laracasts\\Flash": "src/" - }, - "files": [ - "src/Laracasts/Flash/functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jeffrey Way", - "email": "jeffrey@laracasts.com" - } - ], - "description": "Easy flash notifications", - "time": "2016-07-11T20:46:02+00:00" - }, - { "name": "laracasts/presenter", "version": "0.2.1", "source": { diff --git a/config/app.php b/config/app.php index 1ca2f75..d93e4ae 100644 --- a/config/app.php +++ b/config/app.php @@ -173,8 +173,6 @@ return [ App\Providers\AuthServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, - - Laracasts\Flash\FlashServiceProvider::class, ], /* diff --git a/public/assets/js/plugins/noty.js b/public/assets/js/plugins/noty.js new file mode 100644 index 0000000..6902195 --- /dev/null +++ b/public/assets/js/plugins/noty.js @@ -0,0 +1 @@ +!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],b):"object"==typeof exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){"function"!=typeof Object.create&&(Object.create=function(a){function b(){}return b.prototype=a,new b});var b={init:function(b){return this.options=a.extend({},a.noty.defaults,b),this.options.layout=this.options.custom?a.noty.layouts.inline:a.noty.layouts[this.options.layout],a.noty.themes[this.options.theme]?(this.options.theme=a.noty.themes[this.options.theme],this.options.theme.template&&(this.options.template=this.options.theme.template),this.options.theme.animation&&(this.options.animation=this.options.theme.animation)):this.options.themeClassName=this.options.theme,this.options=a.extend({},this.options,this.options.layout.options),this.options.id="noty_"+(new Date).getTime()*Math.floor(1e6*Math.random()),this._build(),this},_build:function(){var b=a('
').attr("id",this.options.id);if(b.append(this.options.template).find(".noty_text").html(this.options.text),this.$bar=null!==this.options.layout.parent.object?a(this.options.layout.parent.object).css(this.options.layout.parent.css).append(b):b,this.options.themeClassName&&this.$bar.addClass(this.options.themeClassName).addClass("noty_container_type_"+this.options.type),this.options.buttons){this.options.closeWith=[],this.options.timeout=!1;var c;this.$bar.find(".noty_buttons").length>0?c=this.$bar.find(".noty_buttons"):(c=a("
").addClass("noty_buttons"),null!==this.options.layout.parent.object?this.$bar.find(".noty_bar").append(c):this.$bar.append(c));var d=this;a.each(this.options.buttons,function(b,e){var f=a(" - {{ Session::get('flash_notification.message') }} -
- @endif -@endif diff --git a/resources/views/vendor/flash/modal.blade.php b/resources/views/vendor/flash/modal.blade.php deleted file mode 100755 index a560c53..0000000 --- a/resources/views/vendor/flash/modal.blade.php +++ /dev/null @@ -1,19 +0,0 @@ -