diff --git a/app/Livewire/Studio/Master/Outlet/Create.php b/app/Livewire/Studio/Master/Outlet/Create.php index ea02c43..0f5b575 100644 --- a/app/Livewire/Studio/Master/Outlet/Create.php +++ b/app/Livewire/Studio/Master/Outlet/Create.php @@ -40,9 +40,9 @@ public function save(): void $this->form->store(); - $this->toast('Outlet berhasil ditambahkan.'); - - $this->redirectRoute('studio.master.outlet.index'); + $this->redirectRoute('studio.master.outlet.index', [ + 'notification' => 'Outlet berhasil ditambahkan.', + ], navigate: true); } public function render(): View diff --git a/app/Livewire/Studio/Master/Outlet/Edit.php b/app/Livewire/Studio/Master/Outlet/Edit.php index 57f04a4..765cc79 100644 --- a/app/Livewire/Studio/Master/Outlet/Edit.php +++ b/app/Livewire/Studio/Master/Outlet/Edit.php @@ -33,9 +33,9 @@ public function save(): void $this->form->update(); - $this->toast('Outlet berhasil diperbarui.'); - - $this->redirectRoute('studio.master.outlet.index'); + $this->redirectRoute('studio.master.outlet.index', [ + 'notification' => 'Outlet berhasil diperbarui.', + ], navigate: true); } public function render(): View diff --git a/app/Livewire/Studio/Master/Outlet/Index.php b/app/Livewire/Studio/Master/Outlet/Index.php index d7a67dc..70c670c 100644 --- a/app/Livewire/Studio/Master/Outlet/Index.php +++ b/app/Livewire/Studio/Master/Outlet/Index.php @@ -29,6 +29,18 @@ class Index extends Component public function mount(): void { + $hasNotification = request()->get('notification'); + + if ($hasNotification) { + $this->js(<<<'JS' + const url = new URL(window.location); + url.search = ''; + window.history.replaceState({}, '', url); + JS); + + $this->toast($hasNotification); + } + $this->loadOutlets(); } diff --git a/app/Livewire/Studio/Master/User/Create.php b/app/Livewire/Studio/Master/User/Create.php index 0591db2..69d54c8 100644 --- a/app/Livewire/Studio/Master/User/Create.php +++ b/app/Livewire/Studio/Master/User/Create.php @@ -38,9 +38,9 @@ public function save(): void $this->form->store(); - $this->toast('Pegawai berhasil ditambahkan.'); - - $this->redirectRoute('studio.master.user.index'); + $this->redirectRoute('studio.master.user.index', [ + 'notification' => 'Pegawai berhasil ditambahkan.', + ]); } public function render(): View diff --git a/app/Livewire/Studio/Master/User/Edit.php b/app/Livewire/Studio/Master/User/Edit.php index c84f2cc..38e5ac4 100644 --- a/app/Livewire/Studio/Master/User/Edit.php +++ b/app/Livewire/Studio/Master/User/Edit.php @@ -41,9 +41,9 @@ public function save(): void $this->form->update(); - $this->toast('Pegawai berhasil diperbarui.'); - - $this->redirectRoute('studio.master.user.index'); + $this->redirectRoute('studio.master.user.index', [ + 'notification' => 'Pegawai berhasil diperbarui.', + ]); } public function render(): View diff --git a/app/Livewire/Studio/Master/User/Index.php b/app/Livewire/Studio/Master/User/Index.php index a96c5c8..f70218c 100644 --- a/app/Livewire/Studio/Master/User/Index.php +++ b/app/Livewire/Studio/Master/User/Index.php @@ -28,6 +28,18 @@ class Index extends Component public function mount(): void { + $hasNotification = request()->get('notification'); + + if ($hasNotification) { + $this->js(<<<'JS' + const url = new URL(window.location); + url.search = ''; + window.history.replaceState({}, '', url); + JS); + + $this->toast($hasNotification); + } + $this->loadEmployees(); }