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

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

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

問題描述

我是 Laravel 的初學者.目前我正在學習這個框架.我當前的 Laravel 版本是 5.3.

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

我看到了一些博客.我找到了一些博客.我已經在我的網站中實現了它.但同樣的輸出來了.

我點擊了這些鏈接 -

希望對您有所幫助!

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!

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

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

相關文檔推薦

Laravel Eloquent Union query(Laravel Eloquent Union 查詢)
Overwrite laravel 5 helper function(覆蓋 Laravel 5 輔助函數)
laravel querybuilder how to use like in wherein function(laravel querybuilder 如何在 where 函數中使用 like)
The Response content must be a string or object implementing __toString(), quot;booleanquot; given after move to psql(響應內容必須是實現 __toString()、“boolean和“boolean的字符串或對象.移動到 psql 后給出) - IT屋-程
Roles with laravel 5, how to allow only admin access to some root(Laravel 5 的角色,如何只允許管理員訪問某些根)
Laravel Auth - use md5 instead of the integrated Hash::make()(Laravel Auth - 使用 md5 而不是集成的 Hash::make())
主站蜘蛛池模板: 久久国产高清 | 激情a | 男人天堂网站 | 欧美日韩中文字幕 | av中文字幕在线 | 欧美精品在线播放 | 欧美久久久久久 | 热99精品视频 | 精品一区二区三区中文字幕 | 欧美男人天堂 | 久久久www成人免费无遮挡大片 | 九九九视频在线观看 | 夜夜操天天艹 | 热99视频 | 中文字幕在线视频精品 | 欧美日韩国产免费 | 久久99精品久久久久久 | 日韩av福利在线观看 | 久久精品国产精品青草 | 免费日韩av网站 | 久久精品久久综合 | 午夜免费在线观看 | 91视频在线观看 | 欧美精品久久 | 午夜视频一区二区三区 | 亚洲免费精品 | 在线久草| 国产精品高清在线 | 美女天天干天天操 | 国产精品视频免费看 | 久久性 | 狠狠影院 | 精品福利视频一区二区三区 | 亚洲一区二区三 | 日韩精品在线播放 | 精品久久不卡 | 91网在线观看 | 成人精品视频在线观看 | 免费在线视频精品 | 欧美精品tv | 毛片入口|