我正在尝试使用Laravel发送恢复邮件。我有以下恢复方法:
public function recovery(Request $request)
{
$validator = Validator::make($request->only('email'), [
'email' => 'required'
]);
if($validator->fails()) {
throw new ValidationHttpException($validator->errors()->all());
}
$response = Password::sendResetLink($request->only('email'), function (Message $message) {
$message->subject(Config::get('boilerplate.recovery_email_subject'));
});
switch ($response) {
case Password::RESET_LINK_SENT:
return $this->response->noContent();
case Password::INVALID_USER:
return $this->response->errorNotFound();
}
}
我尝试输出$request->email
并且重置电子邮件是输出,但由于某些原因我收到以下错误:
Undefined index: email
at
"/home/pokemoti/public_html/api/vendor/laravel/framework/src/Illuminate/Auth/Passwords/PasswordBrokerManager.php" on line 74
知道可能出了什么问题吗?
答案 0 :(得分:1)
通过在我的config/auth.php
密码 - >用户数组中添加以下行来修复此问题:
'email' => 'auth.emails.password',
从另一个有效的项目中获取它。