user(); // $this->enabled strictly means 2FA is fully confirmed in the DB $this->enabled = $user && !empty($user->two_factor_confirmed_at); } /** * Redirect the user to the admin settings page. * * @return \Illuminate\Http\RedirectResponse */ public function redirectToSettings() { $route = ''; $anchor = '#two-factor-authentication-form'; if (session('activeProfileType') == 'App\Models\Organization') { $route = 'profile.settings'; } elseif (session('activeProfileType') == 'App\Models\Bank') { $route = 'profile.bank.settings'; } elseif (session('activeProfileType') == 'App\Models\Admin') { $route = 'profile.admin.settings'; } else { $route = 'profile.user.settings'; } // Generate the URL for the route and append the anchor $url = route($route) . $anchor; return redirect()->to($url); } /** * Get the current user of the application. * * @return mixed */ public function getUserProperty() { return Auth::guard('web')->user(); } /** * Render the component. * * @return \Illuminate\View\View */ public function render() { return view('livewire.profile.two-factor-main-page-card'); } }