From 5351f96d2249e99b121f4a02cc8ad78091627f34 Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Wed, 27 Oct 2021 11:13:20 +0800 Subject: [PATCH] utk dashboard --- app/Events/Dashboard/GadaiNotify.php | 32 ++++++++++++++++++++ app/Events/Dashboard/KeuntunganNotify.php | 32 ++++++++++++++++++++ app/Events/Dashboard/PetibesiNotify.php | 32 ++++++++++++++++++++ app/Events/Dashboard/TebusNotify.php | 32 ++++++++++++++++++++ app/Http/Controllers/GadaianController.php | 6 ++++ app/Http/Controllers/PenebusanController.php | 6 ++++ 6 files changed, 140 insertions(+) create mode 100644 app/Events/Dashboard/GadaiNotify.php create mode 100644 app/Events/Dashboard/KeuntunganNotify.php create mode 100644 app/Events/Dashboard/PetibesiNotify.php create mode 100644 app/Events/Dashboard/TebusNotify.php diff --git a/app/Events/Dashboard/GadaiNotify.php b/app/Events/Dashboard/GadaiNotify.php new file mode 100644 index 0000000..890d782 --- /dev/null +++ b/app/Events/Dashboard/GadaiNotify.php @@ -0,0 +1,32 @@ +response = $response; + $this->cawangan = $cawangan; + } + + public function broadcastOn() + { + return ['gadai-notify']; + } + + public function broadcastAs() + { + return 'trigger-gadai'; + } +} \ No newline at end of file diff --git a/app/Events/Dashboard/KeuntunganNotify.php b/app/Events/Dashboard/KeuntunganNotify.php new file mode 100644 index 0000000..c093e23 --- /dev/null +++ b/app/Events/Dashboard/KeuntunganNotify.php @@ -0,0 +1,32 @@ +response = $response; + $this->cawangan = $cawangan; + } + + public function broadcastOn() + { + return ['keuntungan-notify']; + } + + public function broadcastAs() + { + return 'trigger-keuntungan'; + } +} \ No newline at end of file diff --git a/app/Events/Dashboard/PetibesiNotify.php b/app/Events/Dashboard/PetibesiNotify.php new file mode 100644 index 0000000..62ae2aa --- /dev/null +++ b/app/Events/Dashboard/PetibesiNotify.php @@ -0,0 +1,32 @@ +response = $response; + $this->cawangan = $cawangan; + } + + public function broadcastOn() + { + return ['petibesi-notify']; + } + + public function broadcastAs() + { + return 'trigger-petibesi'; + } +} \ No newline at end of file diff --git a/app/Events/Dashboard/TebusNotify.php b/app/Events/Dashboard/TebusNotify.php new file mode 100644 index 0000000..0a03792 --- /dev/null +++ b/app/Events/Dashboard/TebusNotify.php @@ -0,0 +1,32 @@ +response = $response; + $this->cawangan = $cawangan; + } + + public function broadcastOn() + { + return ['tebus-notify']; + } + + public function broadcastAs() + { + return 'trigger-tebus'; + } +} \ No newline at end of file diff --git a/app/Http/Controllers/GadaianController.php b/app/Http/Controllers/GadaianController.php index 233be33..afc24a6 100644 --- a/app/Http/Controllers/GadaianController.php +++ b/app/Http/Controllers/GadaianController.php @@ -5,6 +5,8 @@ namespace App\Http\Controllers; //Events use App\Events\StatusLiked; use App\Events\NotifikasiPembayaran; +use App\Events\Dashboard\GadaiNotify; + use Illuminate\Http\Request; use App\Services\CustomerService; @@ -184,6 +186,8 @@ class GadaianController extends Controller $this->AliranTunaiController->alirantunaiGadai($request,$auth_user['name']); + event(new GadaiNotify('lulus',$auth_user['cawangan'])); + $request->session()->forget('page_reload'); $request->session()->forget('norujukan'); return redirect()->route('customer_info'); @@ -223,6 +227,8 @@ class GadaianController extends Controller 'norujukan' => $request->norujukan_gadai ])->json(); + event(new GadaiNotify('lulus',$auth_user['cawangan'])); + $request->session()->forget('page_reload'); $request->session()->forget('norujukan'); return redirect()->route('customer_info'); diff --git a/app/Http/Controllers/PenebusanController.php b/app/Http/Controllers/PenebusanController.php index 3ec99ce..ad9c60d 100644 --- a/app/Http/Controllers/PenebusanController.php +++ b/app/Http/Controllers/PenebusanController.php @@ -2,6 +2,10 @@ namespace App\Http\Controllers; +//Events +use App\Events\Dashboard\TebusNotify; +use App\Events\Dashboard\KeuntunganNotify; + use Illuminate\Http\Request; use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Auth; @@ -63,6 +67,8 @@ class PenebusanController extends Controller if($updatetebus) { return response('success'); + + event(new TebusNotify('lulus',$auth_user['cawangan'])); }else{ return response('fail'); }