原理解析:

验证邮箱在Laravel默认实现中是一个Notification,不是Mailable,而为了自定义验证邮箱的默认配置,我们先来查看一下

/vendor/laravel/framework/src/Illuminate/Auth/Notifications/VerifyEmail.php 文件:

  1 /**
2 * Build the mail representation of the notification.
3 *
4 * @param mixed $notifiable
5 * @return \Illuminate\Notifications\Messages\MailMessage
6 */
7 public function toMail($notifiable)
8 {
9 $verificationUrl = $this->verificationUrl($notifiable);
10
11 if (static::$toMailCallback) {
12 return call_user_func(static::$toMailCallback, $notifiable, $verificationUrl);
13 }
14
15 return (new MailMessage)
16 ->subject(Lang::get('Verify Email Address'))
17 ->line(Lang::get('Please click the button below to verify your email address.'))
18 ->action(Lang::get('Verify Email Address'), $verificationUrl)
19 ->line(Lang::get('If you did not create an account, no further action is required.'));
20 }

实现修改:

可以看到,默认验证邮件需要的subject就在这个方法内被配置好了,Lang::get()方法会根据laravel app程序设置的语言,自动翻译参数中的文本。

在 resources/lang 文件夹下创建一个en.json文件,添加原始文本及其替换文本即可实现subject等默认文本的自定义,示例如下:

  1 {
2 "Verify Email Address": "My preferred subject",
3 "Please click the button below to verify your email address.":"Another translation"
4 }

如果需要翻译文本为其他语言,可以安装语言包或者自己创建一个对应的翻译文本,并在 config/app.php 文件中修改 locale值即可。

自定义 Laravel 5.7 - 6.X 中验证邮箱的标题文本的更多相关文章

  1. JAVA中验证邮箱是否有效

    String email = form.getEmail(); if(!email.matches("^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\\.[a-zA ...

  2. Android中自定义样式与View的构造函数中的第三个参数defStyle的意义

    零.序 一.自定义Style 二.在XML中为属性声明属性值 1. 在layout中定义属性 2. 设置Style 3. 通过Theme指定 三.在运行时获取属性值 1. View的第三个构造函数的第 ...

  3. Android 自定义View及其在布局文件中的使用示例(三):结合Android 4.4.2_r1源码分析onMeasure过程

    转载请注明出处 http://www.cnblogs.com/crashmaker/p/3549365.html From crash_coder linguowu linguowu0622@gami ...

  4. Laravel教程 七:表单验证 Validation

    Laravel教程 七:表单验证 Validation 此文章为原创文章,未经同意,禁止转载. Laravel Form 终于要更新这个Laravel系列教程的第七篇了,期间去写了一点其他的东西. 就 ...

  5. asp.net mvc源码分析-DefaultModelBinder 自定义的普通数据类型的绑定和验证

    原文:asp.net mvc源码分析-DefaultModelBinder 自定义的普通数据类型的绑定和验证 在前面的文章中我们曾经涉及到ControllerActionInvoker类GetPara ...

  6. 最适合入门的Laravel中级教程(三)表单验证

    做开发有个原则是永远不能信任用户输入的数据: 即便前端已经做了验证: 在后端 php 也必须要再次验证: laravel 为表单验证提供了强大且简单的方案: 创建示例路由: routes/web.ph ...

  7. 仿联想商城laravel实战---7、lavarel中如何给用户发送邮件

    仿联想商城laravel实战---7.lavarel中如何给用户发送邮件 一.总结 一句话总结: 设置邮件服务器,比如163邮箱 lavarel中配置邮件服务,在.env中 控制器中使用Mail对象发 ...

  8. vue第八单元(组件通信 子父,父子组件通信 自定义事件 事件修饰符 v-model props验证 )

    第八单元(组件通信 子父,父子组件通信 自定义事件 事件修饰符 v-model props验证 ) #课程目标 掌握使用props让父组件给子组件传参(重点) 掌握props属性的使用以及prop验证 ...

  9. Android 自定义View及其在布局文件中的使用示例

    前言: 尽管Android已经为我们提供了一套丰富的控件,如:Button,ImageView,TextView,EditText等众多控件,但是,有时候在项目开发过程中,还是需要开发者自定义一些需要 ...

随机推荐

  1. Call to undefined function Illuminate\Encryption\openssl_cipher_iv_length()

    今天遇到一个错误,没有定义一个openssl_cipher_iv_length()方法,可是我明明开启OpenSSL了啊 如果开启了还报错 只需要把php的目录加入环境变量 -重启电脑  就解决了 但 ...

  2. PTPX-功耗分析总结

    使用PrimeTime PX进行功耗分析有两种:一种是平均功耗的分析Averaged power analysis,一种是Time-based power analysis.   电路的功耗主要有两种 ...

  3. css动画效果之transition(动画过渡效果属性)

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  4. docker 初识1

    学习网址 https://git.oschina.net/yangllsdev/docker-training https://docs.docker.com/engine/installation/ ...

  5. Codeforces Round #599 (Div. 2) C. Tile Painting

    Ujan has been lazy lately, but now has decided to bring his yard to good shape. First, he decided to ...

  6. 1.3 使用jmeter进行http接口测试

    来源: http://www.cnblogs.com/alisapan/p/6150309.html 此篇纯是搬运记载..   一.测试需求描述 1. 本次测试的接口为http服务端接口 2. 接口的 ...

  7. springboot @ComponentScan注解

    @ComponentScan 告诉Spring从哪里找到bean. 如果你的其他包都在@SpringBootApplication注解的启动类所在的包及其下级包,则你什么都不用做,SpringBoot ...

  8. Bug搬运工-CSCux99539:Intermittent error message "Power supply 2 failed or shutdown"

    Description Symptom:Following error messages will be seen intermittently.%PFMA-2-PS_FAIL: Power supp ...

  9. Debian 系统修改网卡ens33名称为 eth0

    1. 编辑文件 /etc/default/grub 修改下面的值 初始值 GRUB_CMDLINE_LINUX="" 修改后 GRUB_CMDLINE_LINUX="ne ...

  10. 转载:AAC编解码概述

    转自:http://www.cnblogs.com/gaozehua/archive/2012/05/03/2479960.html 编码概述 其整体AAC 编解码系统,如图所示,其编码流程概述如下: ...