From f3fb9fd45bf3300531d06b5afde2fab2a8ded126 Mon Sep 17 00:00:00 2001 From: Aji Kamaludin Date: Mon, 3 Jun 2019 17:24:57 +0700 Subject: [PATCH] add flash message --- app/Http/Controllers/PeriodeController.php | 2 +- resources/views/periode/index.blade.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/PeriodeController.php b/app/Http/Controllers/PeriodeController.php index 0fc6fde..91a7abb 100644 --- a/app/Http/Controllers/PeriodeController.php +++ b/app/Http/Controllers/PeriodeController.php @@ -49,7 +49,7 @@ class PeriodeController extends Controller $periode->is_active = 0; } - if($periode->save()){ + if(!$periode->save()){ return redirect()->route('periode.index')->with([ 'type' => 'success', 'msg' => 'Periode baru ditambahkan' diff --git a/resources/views/periode/index.blade.php b/resources/views/periode/index.blade.php index 1fb2966..87fb4fb 100644 --- a/resources/views/periode/index.blade.php +++ b/resources/views/periode/index.blade.php @@ -18,6 +18,11 @@ @if(session()->has('msg'))
+ @if(session()->get('type') == 'success') + + @else + + @endif {{ session()->get('msg') }}
@endif