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

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;
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Python语言实验
  • ¥15 SAP HANA SQL 增加合计行
  • ¥20 用C#语言解决一个英文打字练习器,有偿
  • ¥15 srs-sip外部服务 webrtc支持H265格式
  • ¥15 在使用abaqus软件中,继承到assembly里的surfaces怎么使用python批量调动
  • ¥15 大一C语言期末考试,求帮助🙏🙏
  • ¥15 ch340驱动未分配COM
  • ¥15 Converting circular structure to JSON
  • ¥30 Hyper-v虚拟机相关问题,求解答。
  • ¥15 TSM320F2808PZA芯片 Bootloader