diff --git a/src/Livewire/WithInlineInput.php b/src/Livewire/WithInlineInput.php index 18ede33..060df4d 100644 --- a/src/Livewire/WithInlineInput.php +++ b/src/Livewire/WithInlineInput.php @@ -22,9 +22,10 @@ public function setEditMode() { $this->editMode = true; - $this->dispatchBrowserEvent('edit-mode', [ - 'id' => $this->model()->getKey(), - ]); + $this->dispatch( + 'edit-mode', + id: $this->model()->getKey(), + ); } public function submitInlineData() diff --git a/src/Livewire/WithMap.php b/src/Livewire/WithMap.php index de7566f..ae2f26c 100644 --- a/src/Livewire/WithMap.php +++ b/src/Livewire/WithMap.php @@ -6,18 +6,20 @@ trait WithMap { public function addPlaces(string $mapId, array $places) { - $this->dispatchBrowserEvent($mapId, [ - 'type' => 'loadPlaces', - 'places' => $this->formatPlaces($places), - ]); + $this->dispatch( + $mapId, + type:'loadPlaces', + places:$this->formatPlaces($places), + ); } public function flyTo(string $mapId, string $lng, string $lat) { - $this->dispatchBrowserEvent($mapId, [ - 'type' => 'fly', - 'coordinate' => [$lng, $lat], - ]); + $this->dispatch( + $mapId, + type:'fly', + coordinate:[$lng, $lat], + ); } public function formatPlaces(array $places): array diff --git a/src/Livewire/WithModal.php b/src/Livewire/WithModal.php index 7e09cc7..68bf6db 100644 --- a/src/Livewire/WithModal.php +++ b/src/Livewire/WithModal.php @@ -6,11 +6,11 @@ trait WithModal { public function closeModal(string $modalId) { - $this->dispatchBrowserEvent($modalId, ['type' => 'close']); + $this->dispatch($modalId, type: 'close'); } public function openModal(string $modalId) { - $this->dispatchBrowserEvent($modalId, ['type' => 'open']); + $this->dispatch($modalId, type: 'open'); } } diff --git a/src/Livewire/WithNotification.php b/src/Livewire/WithNotification.php index ec1ee43..1758591 100644 --- a/src/Livewire/WithNotification.php +++ b/src/Livewire/WithNotification.php @@ -6,29 +6,32 @@ trait WithNotification { public function success(string $message, ?array $action = null) { - $this->dispatchBrowserEvent('notify', [ - 'message' => $message, - 'type' => 'success', - 'action' => $action, - ]); + $this->dispatch( + 'notify', + message: $message, + type:'success', + action:$action, + ); } public function error(string $message, ?array $action = null) { - $this->dispatchBrowserEvent('notify', [ - 'message' => $message, - 'type' => 'error', - 'action' => $action, - ]); + $this->dispatch( + 'notify', + message: $message, + type:'error', + action:$action, + ); } public function info(string $message, ?array $action = null) { - $this->dispatchBrowserEvent('notify', [ - 'message' => $message, - 'type' => 'info', - 'action' => $action, - ]); + $this->dispatch( + 'notify', + message: $message, + type:'info', + action:$action, + ); } public function alertInvalidInput(?string $message = null) diff --git a/src/Livewire/WithStepWizard.php b/src/Livewire/WithStepWizard.php index 1909f60..319f0c6 100644 --- a/src/Livewire/WithStepWizard.php +++ b/src/Livewire/WithStepWizard.php @@ -31,12 +31,12 @@ public function next(): void { $livewireComponentId = $this->submit(); - $this->dispatchBrowserEvent('next-step-emitted', $livewireComponentId); + $this->dispatch('next-step-emitted', $livewireComponentId); } public function back(): void { - $this->dispatchBrowserEvent('previous-step-emitted'); + $this->dispatch('previous-step-emitted'); } protected function fillSessionData() diff --git a/src/Livewire/WithStripe.php b/src/Livewire/WithStripe.php index 0d655e8..db22aa1 100644 --- a/src/Livewire/WithStripe.php +++ b/src/Livewire/WithStripe.php @@ -33,13 +33,14 @@ public function updateStripePaymentMethod(string $event, string $message) $this->emitSelf('stripePaymentMethodUpdated', $billable); // Let Alpinejs now Stripe payment method updated. - $this->dispatchBrowserEvent('stripe-payment-method-updated'); + $this->dispatch('stripe-payment-method-updated'); // Notify payment method was updated. - $this->dispatchBrowserEvent(empty($event) ? 'notify' : $event, [ - 'type' => 'success', - 'message' => empty($message) ? 'Your payment method was updated!' : $message, - ]); + $this->dispatch( + empty($event) ? 'notify' : $event, + type: 'success', + message: empty($message) ? 'Your payment method was updated!' : $message, + ); return [ 'card_brand' => $billable->card_brand,