first(); $config = $addon?->config ?? []; $this->email = $config['email'] ?? ''; $this->hasStoredPassword = filled($config['password'] ?? null); } public function save() { $this->validate([ 'email' => 'required|email|max:190', // Password may be left blank to keep a previously stored one. 'password' => $this->hasStoredPassword ? 'nullable|string|max:190' : 'required|string|max:190', 'code' => 'nullable|string|max:12', ]); app(AddonService::class)->saveConnection('ring', [ 'email' => $this->email, 'password' => $this->password, 'code' => $this->code, ]); $this->closeModal(); return redirect()->route('addons.index'); } public function render() { return view('livewire.modals.ring-connect'); } }