久久久久久久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())
主站蜘蛛池模板: 日韩欧美在线观看 | 午夜一区二区三区 | 欧美日韩一区二区在线观看 | 欧美a在线 | 欧美电影一区 | 在线免费观看a级片 | 国产乱码精品一区二区三区五月婷 | 亚洲九九| 国产精品国产精品国产专区不卡 | 欧美性猛交一区二区三区精品 | 久久久精选 | 日日噜噜噜夜夜爽爽狠狠视频97 | 黄色免费av | 欧美精品免费观看二区 | 成人小视频在线观看 | 一区精品视频在线观看 | 在线免费av电影 | 国产精品精品视频一区二区三区 | 精品国产免费人成在线观看 | 色综合久 | 精品国产精品国产偷麻豆 | 国产一二三视频在线观看 | 国产91av视频在线观看 | 爱爱视频网 | 欧美性生活一区二区三区 | 久久综合狠狠综合久久综合88 | 国产亚洲精品精品国产亚洲综合 | 91精品国产手机 | 99视频在线免费观看 | 99久久亚洲 | 亚洲国产18| 国产japanhdxxxx麻豆 | 日本超碰| 国产精品人人做人人爽 | 国产精品毛片 | 人人干人人爽 | aaaaaa大片免费看最大的 | 韩国av影院| 欧美激情一区二区三区 | 日韩欧美专区 | 在线不卡视频 |