From 08e76fea6749e85325e166ecf1458dfbaa650f1c Mon Sep 17 00:00:00 2001 From: fiqhpratama Date: Thu, 26 Dec 2024 12:19:06 +0700 Subject: [PATCH] enhance dikit --- app/Http/Controllers/Forms/FormUpCountryController.php | 2 ++ .../views/backend/layouts/partials/messages.blade.php | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/app/Http/Controllers/Forms/FormUpCountryController.php b/app/Http/Controllers/Forms/FormUpCountryController.php index faafb15..0697156 100644 --- a/app/Http/Controllers/Forms/FormUpCountryController.php +++ b/app/Http/Controllers/Forms/FormUpCountryController.php @@ -137,6 +137,8 @@ class FormUpCountryController extends Controller ]); session()->flash('success', 'Form has been created.'); + session()->flash('redirect_url', route('forms.up-country')); + return redirect()->back(); } diff --git a/resources/views/backend/layouts/partials/messages.blade.php b/resources/views/backend/layouts/partials/messages.blade.php index 698dc91..4c582f8 100644 --- a/resources/views/backend/layouts/partials/messages.blade.php +++ b/resources/views/backend/layouts/partials/messages.blade.php @@ -19,6 +19,10 @@ title: "Success!", text: "{{ Session::get('success') }}", icon: "success" + }).then(() => { + if ("{{ Session::get('redirect_url') }}") { + window.location.href = "{{ Session::get('redirect_url') }}"; + } }); @endif @@ -30,6 +34,10 @@ text: "{{ Session::get('error') }}", icon: "error", timer: 5000 + }).then(() => { + if ("{{ Session::get('redirect_url') }}") { + window.location.href = "{{ Session::get('redirect_url') }}"; + } }); @endif