简体   繁体   中英

Laravel change Reset Password email greeting with variable

I have an laravel 5.8 app, with the default auth installed. I want to pass a variable to the password reset email template, so the greeting would look like "Hello, [username]". The current email template looks like this: 在此处输入图片说明

I didn't find where in the core files I can change this "Hello!" heading of the message

EDIT: In my controller, I send the password reset like this(maybe the variable should be put somewhere on this line)

$response = Password::sendResetLink($credentials, function (Message $message) {
            $message->subject($this->getEmailSubject());
        });

In a default Laravel app, the User model has a CanResetPassword interface with a sendPasswordResetNotification method. This method is created in a CanResetPassword trait that the user also uses.

You could override this with your own method and create your own ResetPasswordNotification class. Try following it from the trait to that class.

It does not look like it uses a view for the markup, so it shouldn't be too hard to do. The ResetPassword class takes accepts a Notifiable , so you should have access to the name in there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM