From 2c1cb88783b8c6a319c33fd2e5a99b590399b942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Thu, 8 Feb 2024 19:55:35 +0100 Subject: [PATCH] Add Purchase component to BillingPortal --- app/Livewire/BillingPortal/Purchase.php | 77 +++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 app/Livewire/BillingPortal/Purchase.php diff --git a/app/Livewire/BillingPortal/Purchase.php b/app/Livewire/BillingPortal/Purchase.php new file mode 100644 index 000000000000..0b8fd934249e --- /dev/null +++ b/app/Livewire/BillingPortal/Purchase.php @@ -0,0 +1,77 @@ +context[$property] = $value; + } + + #[On('purchase.next')] + public function handleNext(): void + { + if ($this->step < count($this->steps) - 1) { + $this->step++; + } + } + + #[On('purchase.forward')] + public function handleForward(string $component): void + { + $this->step = array_search($component, $this->steps); + } + + #[Computed()] + public function component(): string + { + return $this->steps[$this->step]; + } + + public function mount() + { + MultiDB::setDb($this->db); + + $this->context = [ + 'quantity' => 1, + ]; + } + + public function render() + { + return view('billing-portal.v3.purchase'); + } +}