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

报告相同问题?

悬赏问题

  • ¥15 matlab有关常微分方程的问题求解决
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable