form->validate(); if ($this->mode === 'create') { $create->execute(new ProvisionConsumerAppDTO( name: $this->form->name, domain: $this->form->domain, webhook_url: $this->form->webhook, auth_type: $this->form->auth_type, credentials: $this->form->auth_type->transformCredentials($this->form->credentials), )); } else { $modify->execute($this->client, new ModifyConsumerAppDetailDTO( webhook_url: $this->form->webhook, auth_type: $this->form->auth_type, credentials: $this->form->auth_type->transformCredentials($this->form->credentials), )); } $this->success($this->message); $this->dispatch('hide-client-form-modal'); $this->js("LaravelDataTables['client-table'].ajax.reload(null, false)"); $this->form->reset(); $this->form->resetValidation(); $this->reset('id', 'mode'); } #[Computed] public function client(): ?Client { return $this->id ? Client::where('ulid', $this->id)->first() : null; } public function show(int|string $id): void { $this->id = $id; $this->mode = 'update'; $this->form->fill($this->client->only(['name', 'webhook', 'domain', 'auth_type', 'credentials'])); } public function hide(): void { $this->form->reset(); $this->form->resetValidation(); $this->reset('id', 'mode'); } };