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

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

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

問題描述

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

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

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

我點擊了這些鏈接 -

希望對您有所幫助!

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中更改重置密碼的電子郵件主題?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(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)容必須是實現(xiàn) __toString()、“boolean和“boolean的字符串或?qū)ο?移動到 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())
主站蜘蛛池模板: 中文字幕一区二区三区在线乱码 | 亚洲视频网 | 最新av中文字幕 | 亚洲国产片 | 九九热最新地址 | 久久久久久久国产精品 | 91色在线 | 亚洲一区二区欧美 | 一区二区三区国产 | 一区二区三区四区av | 久久久99精品免费观看 | 狠狠ri | 日本精品一区二区在线观看 | 日日骚av | 国产三级大片 | 国产日韩欧美二区 | 五月婷婷导航 | 欧美激情精品久久久久久变态 | 国产一级片在线播放 | 91精品国产综合久久婷婷香蕉 | 91社区视频 | 国产高潮av | 在线观看国产视频 | 色综合久久天天综合网 | 亚洲精品久久久久久久久久久 | 中文字幕亚洲视频 | 亚洲视频在线观看 | 国精久久| 狠狠干狠狠插 | 精品久久国产 | 一区二区三区在线 | 欧 | 视频1区 | 亚州春色| h漫在线观看 | 亚洲精品久久久蜜桃网站 | 伊人网伊人网 | 懂色av色香蕉一区二区蜜桃 | 国产免费让你躁在线视频 | 99精品免费久久久久久久久日本 | 亚洲激情av | 四虎成人精品永久免费av九九 |