From 12053e18f7ba4c6261580c3733fb5b8dc0d3933f Mon Sep 17 00:00:00 2001 From: Yoga Pangestu Date: Thu, 18 Dec 2025 10:03:21 +0700 Subject: [PATCH] feat: add `WithRequestNotification` trait and update purchase creation to use redirect-based success messages. --- app/Livewire/Studio/Manage/Purchase/Create.php | 8 +++----- app/Livewire/Studio/Manage/Purchase/Index.php | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/Livewire/Studio/Manage/Purchase/Create.php b/app/Livewire/Studio/Manage/Purchase/Create.php index e78a155..15eee93 100644 --- a/app/Livewire/Studio/Manage/Purchase/Create.php +++ b/app/Livewire/Studio/Manage/Purchase/Create.php @@ -63,11 +63,9 @@ public function save(): void $this->form->store(); - $this->dispatch('refreshDatatable'); - - $this->toast('Belanja berhasil ditambahkan.'); - - $this->redirectRoute('studio.manage.purchase.index'); + $this->redirectRoute('studio.manage.purchase.index', [ + 'notification' => 'Belanja berhasil ditambahkan.', + ], navigate: true); } public function updatedFormOutletId($value): void diff --git a/app/Livewire/Studio/Manage/Purchase/Index.php b/app/Livewire/Studio/Manage/Purchase/Index.php index 6659d78..651bf32 100644 --- a/app/Livewire/Studio/Manage/Purchase/Index.php +++ b/app/Livewire/Studio/Manage/Purchase/Index.php @@ -9,6 +9,7 @@ use App\Traits\Components\WithToast; use App\Traits\Notification\WithSubscribeNotification; use App\Traits\Purchase\WithUpdateStock; +use App\Traits\Utilities\WithRequestNotification; use Flux\Flux; use Illuminate\Contracts\View\View; use Illuminate\Support\Facades\DB; @@ -18,7 +19,7 @@ #[Title('Belanja')] class Index extends Component { - use WithAuthorization, WithCloseModal, WithConfirmation, WithSubscribeNotification, WithToast, WithUpdateStock; + use WithAuthorization, WithCloseModal, WithConfirmation, WithRequestNotification, WithSubscribeNotification, WithToast, WithUpdateStock; public function delete(Purchase $purchase): void {