dongwei1234 2016-05-29 12:45
浏览 68
已采纳

Laravel:密码重置针对用户的电子邮件检查

I have the following code to send the password reset email to the users email which is working:

$response = $this->passwords->sendResetLink($request->only('email'),function($message)
{
    $message->subject('Password Reminder');
});

What i want is that user should write their username instead of email, And i will check the email against that username , And will send the email.So i came up with this idea.

    $usernameToEmail = User::where('name','=', Input::get('username'))->first();  

    $response = $this->passwords->sendResetLink(['name' => $usernameToEmail],function($message)
    {
        $message->subject('Password Reminder');
    });

Which is not working also.

Am i missing something ?

  • 写回答

1条回答 默认 最新

  • doutan1637 2016-05-29 12:54
    关注

    You're close, but your $usernameToEmail variable contains a User object, not an email string. Most likely you just need to add a method to your chain:

    $usernameToEmail = User::where('name','=', Input::get('username'))->first()->email;
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 正弦信号发生器串并联电路电阻无法保持同步怎么办
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序