user(); $user->load('employee'); $this->accountForm->setAccount($user); $this->profileForm->setProfile($user->employee); $this->passwordForm->setUser($user); } public function updateAccount() { $this->canOrAbort('update account'); $this->accountForm->update(); $this->toast('Akun berhasil diperbarui.'); } public function updateProfile() { $this->canOrAbort('update profile'); $this->profileForm->update(); $this->toast('Profil berhasil diperbarui.'); } public function updatePassword() { $this->canOrAbort('update password'); if (! Hash::check($this->passwordForm->current_password, $this->passwordForm->user->password)) { $this->toast('Kata sandi yang Anda masukkan tidak sesuai dengan kata sandi saat ini.', 'Gagal', 'danger'); return; } $this->passwordForm->update(); auth()->logoutOtherDevices($this->passwordForm->current_password); auth()->logout(); session()->invalidate(); session()->regenerateToken(); $this->toast('Kata sandi berhasil diperbarui, Silakan masuk kembali.'); $this->redirectRoute('login', navigate: true); } public function render() { return view('livewire.studio.setting.account', [ 'pageTitle' => 'Akun', ]); } }