久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何在laravel中更改重置密碼的電子郵件主題?

How to change reset password email subject in laravel?(如何在laravel中更改重置密碼的電子郵件主題?)
本文介紹了如何在laravel中更改重置密碼的電子郵件主題?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

我是 Laravel 的初學(xué)者.目前我正在學(xué)習(xí)這個(gè)框架.我當(dāng)前的 Laravel 版本是 5.3.

我正在使用 php artisan make:auth 搭建我的身份驗(yàn)證,一切正常.我還在我的 .env 文件中配置了 gmail smtp,在配置目錄中配置了 mail.php.一切都完美無(wú)缺.但是我看到默認(rèn)情況下忘記密碼的電子郵件主題是 Reset Password.我想改變它.

我看到了一些博客.我找到了一些博客.我已經(jīng)在我的網(wǎng)站中實(shí)現(xiàn)了它.但同樣的輸出來(lái)了.

我點(diǎn)擊了這些鏈接 -

希望對(duì)您有所幫助!

I am beginner in Laravel. Currently I am learning this framework. My curent Laravel version is 5.3.

I am scaffolding my auth by using php artisan make:auth All are working fine. Also I configured gmail smtp in my .env file and mail.php in config directgory. All are perfectly working. But I saw by-default the forgot password email subject is going Reset Password. I want to change that.

I saw some blog. I found some blog. I have implement that in my site. But same output coming.

I followed these links -

https://laracasts.com/discuss/channels/general-discussion/laravel-5-password-reset-link-subject

https://laracasts.com/discuss/channels/general-discussion/reset-password-email-subject

https://laracasts.com/discuss/channels/laravel/how-to-override-message-in-sendresetlinkemail-in-forgotpasswordcontroller

解決方案

You can change your password reset email subject, but it will need some extra work. First, you need to create your own implementation of ResetPassword notification.

Create a new notification class insideappNotifications directory, let's named it ResetPassword.php:

<?php

namespace AppNotifications;

use IlluminateNotificationsNotification;
use IlluminateNotificationsMessagesMailMessage;

class ResetPassword extends Notification
{
    public $token;

    public function __construct($token)
    {
        $this->token = $token;
    }

    public function via($notifiable)
    {
        return ['mail'];
    }

    public function toMail($notifiable)
    {
        return (new MailMessage)
            ->subject('Your Reset Password Subject Here')
            ->line('You are receiving this email because we received a password reset request for your account.')
            ->action('Reset Password', url('password/reset', $this->token))
            ->line('If you did not request a password reset, no further action is required.');
    }
}

You can also generate the notification template using artisan command:

php artisan make:notification ResetPassword

Or you can simply copy-paste the above code. As you may notice this notification class is pretty similar with the default IlluminateAuthNotificationsResetPassword. You can actually just extend it from the default ResetPassword class.

The only difference is here, you add a new method call to define the email's subject:

return (new MailMessage)
        ->subject('Your Reset Password Subject Here')

You may read more about Mail Notifications here.

Secondly, on your appUser.php file, you need to override the default sendPasswordResetNotification() method defined by IlluminateAuthPasswordsCanResetPassword trait. Now you should use your own ResetPassword implementation:

<?php

namespace App;

use IlluminateNotificationsNotifiable;
use IlluminateFoundationAuthUser as Authenticatable;
use AppNotificationsResetPassword as ResetPasswordNotification;

class User extends Authenticatable
{
    use Notifiable;

    ...

    public function sendPasswordResetNotification($token)
    {
        // Your your own implementation.
        $this->notify(new ResetPasswordNotification($token));
    }
}

And now your reset password email subject should be updated!

Hope this help!

這篇關(guān)于如何在laravel中更改重置密碼的電子郵件主題?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Laravel Eloquent Union query(Laravel Eloquent Union 查詢)
Overwrite laravel 5 helper function(覆蓋 Laravel 5 輔助函數(shù))
laravel querybuilder how to use like in wherein function(laravel querybuilder 如何在 where 函數(shù)中使用 like)
The Response content must be a string or object implementing __toString(), quot;booleanquot; given after move to psql(響應(yīng)內(nèi)容必須是實(shí)現(xiàn) __toString()、“boolean和“boolean的字符串或?qū)ο?移動(dòng)到 psql 后給出) - IT屋-程
Roles with laravel 5, how to allow only admin access to some root(Laravel 5 的角色,如何只允許管理員訪問(wèn)某些根)
Laravel Auth - use md5 instead of the integrated Hash::make()(Laravel Auth - 使用 md5 而不是集成的 Hash::make())
主站蜘蛛池模板: 国产露脸国语对白在线 | 一区二区三区视频免费看 | 日操操夜操操 | 久久999 | 国产精品久久久久久久久免费相片 | 国产一区二 | 无吗视频 | 色综合一区二区 | 一区二区免费看 | 亚洲高清在线观看 | 在线视频h| 欧美日韩国产传媒 | 在线日韩视频 | 一区二区三区四区五区在线视频 | 精品日韩一区二区 | 久久精品久久久 | 99精品久久久久 | 一本一道久久a久久精品综合 | 99色综合| 日本午夜免费福利视频 | 日韩三级在线 | 天天摸天天看 | 国产一区二 | 正在播放一区二区 | 国产精品高 | 国产精品毛片一区二区三区 | 日本小视频网站 | 久久精品一区二区三区四区 | 欧美激情精品久久久久久 | 日韩精品在线一区 | 国产福利在线播放 | 狠狠做六月爱婷婷综合aⅴ 国产精品视频网 | 丝袜一区二区三区 | 欧美一区免费 | 国产成人免费视频 | 中文字幕在线精品 | 97精品超碰一区二区三区 | 亚洲国产欧美一区 | 天天操天天插天天干 | 免费人成在线观看网站 | 国产一区二区三区在线 |