filled('recovery_code') ? ['recovery_code', __('The provided two factor recovery code was invalid.')] : ['code', __('The provided two factor authentication code was invalid.')]; if ($request->wantsJson()) { throw ValidationException::withMessages([ $key => [$message], ]); } return redirect()->route('two-factor.login')->withErrors([$key => $message]); } }