false, 'register_form' => false, ]; public array $registration_fields = []; public function initial() { $this->validateOnly('email', ['email' => 'required|bail|email:rfc']); $contact = ClientContact::where('email', $this->email) ->where('company_id', $this->subscription->company_id) ->first(); if ($contact) { $this->addError('email', ctrans('texts.checkout_only_for_new_customers')); return; } $this->state['initial_completed'] = true; $this->state['register_form'] = true; } public function register(array $data) { $service = new ClientRegisterService( company: $this->subscription->company, ); $rules = $service->rules(); $data = Validator::make($data, $rules)->validate(); $client = $service->createClient($data); $contact = $service->createClientContact($data, $client); auth()->guard('contact')->loginUsingId($contact->id, true); $this->dispatch('purchase.context', property: 'contact', value: $contact); $this->dispatch('purchase.next'); } public function mount() { if (auth()->guard('contact')->check()) { $this->dispatch('purchase.context', property: 'contact', value: auth()->guard('contact')->user()); $this->dispatch('purchase.next'); } } public function render() { return view('billing-portal.v3.authentication.register'); } }