Laravel 4 中的电子邮件主题



我有一个简单的问题,直到现在我都无法解决,问题是当用户要求休息密码时,电子邮件发送正确,除了电子邮件不包含主题的一件事。我想添加主题,但我无法做到。

这是我控制器中的postRemind 函数:

 public function postRemind()
    {
        $this->reminderForm->validate(Input::only('email'));
        switch ($response = Password::remind(Input::only('email'))) {
            case Password::INVALID_USER:
                return Redirect::back()->with('error', Lang::get($response));
            case Password::REMINDER_SENT:
                return Redirect::back()->with('status', Lang::get($response));
        }
    }

这是我的刀片:

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
</head>
<body>
    <h3>Password Reset</h3>
    <div>
        You have requested password reset. Complete this form: {{ URL::to('password/reset', array($token)) }}
    </div>
</body>
</html>

您可以将闭包传递给可以设置主题Password::remind

https://laravel.com/docs/4.2/security#password-reminders-and-reset

public function postRemind()
{
    $this->reminderForm->validate(Input::only('email'));
    $response = Password::remind(Input::only('email'), function($message)
    {
        $message->subject('Password Reminder');
    });
    switch ($response) {
        case Password::INVALID_USER:
            return Redirect::back()->with('error', Lang::get($response));
        case Password::REMINDER_SENT:
            return Redirect::back()->with('status', Lang::get($response));
    }
}

相关内容

  • 没有找到相关文章

最新更新