string('password'); $confirmed = app(ConfirmPassword::class)($guard, $request->user(), $password); if (! $confirmed) { throw ValidationException::withMessages([ 'password' => __('The password is incorrect.'), ]); } $guard->logoutOtherDevices($password); $this->deleteOtherSessionRecords($request); return back(303); } /** * Delete the other browser session records from storage. */ protected function deleteOtherSessionRecords(Request $request): void { if (config('session.driver') !== 'database') { return; } DB::connection(config('session.connection')) ->table(config('session.table', 'sessions')) ->where('user_id', $request->user()->getAuthIdentifier()) ->where('id', '!=', $request->session()->getId()) ->delete(); } }