diff --git a/app/Http/Controllers/PeriodeController.php b/app/Http/Controllers/PeriodeController.php index 14a9aae..0fc6fde 100644 --- a/app/Http/Controllers/PeriodeController.php +++ b/app/Http/Controllers/PeriodeController.php @@ -36,7 +36,6 @@ class PeriodeController extends Controller */ public function store(Request $request) { - //validate $request->validate([ 'nama' => 'required|max:255', 'tgl_mulai' => 'required|date|before:'.$request->tgl_selesai, @@ -44,9 +43,22 @@ class PeriodeController extends Controller 'is_active' => 'nullable|boolean', ]); - //input - if(Periode::create($request->input())){ + $periode = Periode::make($request->input()); + if($request->is_active == null){ + $periode->is_active = 0; + } + + if($periode->save()){ + return redirect()->route('periode.index')->with([ + 'type' => 'success', + 'msg' => 'Periode baru ditambahkan' + ]); + }else{ + return redirect()->route('periode.index')->with([ + 'type' => 'danger', + 'msg' => 'Err.., Terjadi Kesalahan' + ]); } } diff --git a/composer.json b/composer.json index c9564a1..35640d6 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,8 @@ "php": "^7.1.3", "fideloper/proxy": "^4.0", "laravel/framework": "5.8.*", - "laravel/tinker": "^1.0" + "laravel/tinker": "^1.0", + "yoeunes/notify": "^1.0" }, "require-dev": { "beyondcode/laravel-dump-server": "^1.0", diff --git a/composer.lock b/composer.lock index b0d7f26..0d5bb9c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "94d4bf9ac7f4a933030e46a346ee2917", + "content-hash": "f4285d91336a179e52096b5a76f07d4e", "packages": [ { "name": "dnoegel/php-xdg-base-dir", @@ -2643,6 +2643,88 @@ "environment" ], "time": "2019-03-06T09:39:45+00:00" + }, + { + "name": "yoeunes/notify", + "version": "v1.0.3", + "source": { + "type": "git", + "url": "https://github.com/yoeunes/notify.git", + "reference": "ec85345b990e8abc7afdf7fde74571e29e8112f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yoeunes/notify/zipball/ec85345b990e8abc7afdf7fde74571e29e8112f5", + "reference": "ec85345b990e8abc7afdf7fde74571e29e8112f5", + "shasum": "" + }, + "require": { + "illuminate/session": "5.5.*|5.6.*|5.7.*|5.8.*", + "illuminate/support": "5.5.*|5.6.*|5.7.*|5.8.*", + "php": "^7.0|^7.1|^7.2" + }, + "require-dev": { + "orchestra/testbench": "3.5.*|3.6.*|3.7.*", + "phpunit/phpunit": "^6.2|^7.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Yoeunes\\Notify\\NotifyServiceProvider" + ], + "aliases": { + "Notify": "Yoeunes\\Notify\\Facades\\Notify" + } + } + }, + "autoload": { + "psr-4": { + "Yoeunes\\Notify\\": "src" + }, + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Younes Khoubza", + "email": "younes.khoubza@gmail.com", + "homepage": "https://github.com/yoeunes/notify", + "role": "Developer" + } + ], + "description": "toastr.js, pnotify.js flush notifications for Laravel 5 and Lumen", + "homepage": "https://github.com/yoeunes/notify", + "keywords": [ + "Laravel 5.6", + "alerts", + "flush", + "flush messages", + "flush notifications", + "laravel", + "laravel 5", + "laravel 5.7", + "laravel 5.8", + "laravel flush notifications", + "laravel notification", + "laravel pnotify", + "laravel toastr", + "lumen", + "messages", + "notification", + "php", + "pnotify", + "pnotify js", + "toastr", + "toastr js", + "yoeunes" + ], + "time": "2019-03-08T15:50:52+00:00" } ], "packages-dev": [ diff --git a/public/assets/js/core.js b/public/assets/js/core.js index 6333a12..d1859cc 100644 --- a/public/assets/js/core.js +++ b/public/assets/js/core.js @@ -104,4 +104,8 @@ $(document).ready(function() { }); }); } + + setTimeout(function() { + $("#message").hide('blind', '', 500) + }, 3000); }); \ No newline at end of file diff --git a/resources/views/periode/index.blade.php b/resources/views/periode/index.blade.php index e57c40d..1fb2966 100644 --- a/resources/views/periode/index.blade.php +++ b/resources/views/periode/index.blade.php @@ -16,7 +16,13 @@

@yield('page-name')

Tambah Periode + @if(session()->has('msg')) +
+ {{ session()->get('msg') }} +
+ @endif
+ @@ -29,9 +35,9 @@ - @foreach ($periode as $item) + @foreach ($periode as $index => $item) - + @endforeach @@ -65,4 +74,30 @@ +@endsection +@section('js') + @endsection \ No newline at end of file diff --git a/resources/views/siswa/index.blade.php b/resources/views/siswa/index.blade.php index 7c54531..746d0a9 100644 --- a/resources/views/siswa/index.blade.php +++ b/resources/views/siswa/index.blade.php @@ -112,6 +112,5 @@ }); }); - @endsection
{{ $item->id }}{{ $index+1 }} {{ $item->nama }} {{ $item->tgl_mulai }} @@ -46,9 +52,12 @@ - + +
+ @csrf +