pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

如何在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())
主站蜘蛛池模板: 九州网址_专注于提供网址大全分享推广中文网站导航服务 | 影视模板素材_原创专业影视实拍视频素材-8k像素素材网 | 青州搬家公司电话_青州搬家公司哪家好「鸿喜」青州搬家 | 儋州在线-儋州招聘找工作、找房子、找对象,儋州综合生活信息门户! | 安徽净化板_合肥岩棉板厂家_玻镁板厂家_安徽科艺美洁净科技有限公司 | 武汉创亿电气设备有限公司_电力检测设备生产厂家 | POS机官网 - 拉卡拉POS机免费办理|官网在线申请入口 | 河南空气能热水器-洛阳空气能采暖-洛阳太阳能热水工程-洛阳润达高科空气能商行 | 高考志愿规划师_高考规划师_高考培训师_高报师_升学规划师_高考志愿规划师培训认证机构「向阳生涯」 | 色谱柱-淋洗液罐-巴罗克试剂槽-巴氏吸管-5ml样品瓶-SBS液氮冻存管-上海希言科学仪器有限公司 | 河南卓美创业科技有限公司-河南卓美防雷公司-防雷接地-防雷工程-重庆避雷针-避雷器-防雷检测-避雷带-避雷针-避雷塔、机房防雷、古建筑防雷等-山西防雷公司 | 广州活动策划公司-15+年专业大型公关活动策划执行管理经验-睿阳广告 | 焊管生产线_焊管机组_轧辊模具_焊管设备_焊管设备厂家_石家庄翔昱机械 | 圆窗水平仪|伊莉莎冈特elesa+ganter | 耐火砖厂家,异形耐火砖-山东瑞耐耐火材料厂 | 净化车间_洁净厂房_净化公司_净化厂房_无尘室工程_洁净工程装修|改造|施工-深圳净化公司 | 扫地车厂家-山西洗地机-太原电动扫地车「大同朔州吕梁晋中忻州长治晋城洗地机」山西锦力环保科技有限公司 | 石家庄救护车出租_重症转院_跨省跨境医疗转送_活动赛事医疗保障_康复出院_放弃治疗_腾康26年医疗护送转诊团队 | 「阿尔法设计官网」工业设计_产品设计_产品外观设计 深圳工业设计公司 | 成都租车_成都租车公司_成都租车网_众行宝 | 干法制粒机_智能干法制粒机_张家港市开创机械制造有限公司 | 江西自考网-江西自学考试网| 江苏南京多语种翻译-专业翻译公司报价-正规商务翻译机构-南京华彦翻译服务有限公司 | 广州迈驰新GMP兽药包装机首页_药品包装机_中药散剂包装机 | 金属抛光机-磁悬浮抛光机-磁力研磨机-磁力清洗机 - 苏州冠古科技 | 篷房|仓储篷房|铝合金篷房|体育篷房|篷房厂家-华烨建筑科技官网 知名电动蝶阀,电动球阀,气动蝶阀,气动球阀生产厂家|价格透明-【固菲阀门官网】 | 成都竞价托管_抖音代运营_网站建设_成都SEM外包-成都智网创联网络科技有限公司 | ptc_浴霸_大巴_干衣机_呼吸机_毛巾架_电动车加热器-上海帕克 | 国产离子色谱仪,红外分光测油仪,自动烟尘烟气测试仪-青岛埃仑通用科技有限公司 | 防勒索软件_数据防泄密_Trellix(原McAfee)核心代理商_Trellix(原Fireeye)售后-广州文智信息科技有限公司 | 东莞压铸厂_精密压铸_锌合金压铸_铝合金压铸_压铸件加工_东莞祥宇金属制品 | 上海租车公司_上海包车_奔驰租赁_上海商务租车_上海谐焕租车 | 室内室外厚型|超薄型|非膨胀型钢结构防火涂料_隧道专用防火涂料厂家|电话|价格|批发|施工 | 轻型地埋电缆故障测试仪,频响法绕组变形测试仪,静荷式卧式拉力试验机-扬州苏电 | 中图网(原中国图书网):网上书店,尾货特色书店,30万种特价书低至2折! | ◆大型吹塑加工|吹塑加工|吹塑代加工|吹塑加工厂|吹塑设备|滚塑加工|滚塑代加工-莱力奇塑业有限公司 | 仿古瓦,仿古金属瓦,铝瓦,铜瓦,铝合金瓦-西安东申景观艺术工程有限公司 | 发光字|标识设计|标牌制作|精神堡垒 - 江苏苏通广告有限公司 | 钢木实验台-全钢实验台-化验室通风柜-实验室装修厂家-杭州博扬实验设备 | 消防泵-XBD单级卧式/立式消防泵-上海塑泉泵阀(集团)有限公司 | 校服厂家,英伦校服定做工厂,园服生产定制厂商-东莞市艾咪天使校服 |