get('email'); if (config('captcha.enabled') == false) { $v = validator($request->all(), [ 'email' => 'required', ]); } else { $v = validator($request->all(), [ 'email' => 'required', 'g-recaptcha-response' => 'required|recaptcha', ]); } if ($v->fails()) { return redirect()->route('username.request') ->withErrors($v->errors()); } else { $user = User::where('email', '=', $email)->first(); if (empty($user)) { return redirect()->route('username.request') ->withErrors(trans('email.no-email-found')); } //send username reminder notification $user->notify(new UsernameReminder()); return redirect()->route('login') ->withSuccess(trans('email.username-sent')); } } }