如何更改通知邮件->操作功能按钮默认颜色Laravel?
How to change notification mail ->action function button default color Laravel?
我有一个任务。在通知邮件文件中,我需要在 public 函数中添加一个按钮 toMail():
我做到了,但是按钮的背景色默认是黑色,我需要做成蓝色 .如何更改此功能中的颜色和按钮的代码?
这是代码示例:
public function toMail(): MailMessage
{
return (new MailMessage())
->action('Button name', rout('route.name'))
}
那么如何将背景颜色从默认黑色更改为我选择的按钮颜色(例如蓝色)?
谢谢。
SimpleMessage class 旨在创建具有一个号召性用语按钮的简单消息,您可以在 Illuminate/Notifications/Messages/SimpleMessage.php and the template for the SimpleMessage emails can be found in Illuminate/Notifications/resources/views/email.blade.php 中找到支持该功能的代码 — 请注意单个按钮。
您可以使用 Markdown 邮件通知功能创建更复杂的消息,这将允许您包含任意数量的按钮。您可以这样实现:
运行 生成新通知并传入 markdown 选项的命令,例如:php artisan make:notification InvoicePaid --markdown=mail.invoice.paid
打开新创建的模板,例如:views/mail/invoice/paid.blade.php
添加任意数量的按钮,例如:
@component('mail::message')
# Introduction
@component('mail::button', ['url' => $url1])
Button 1 Text
@endcomponent
@component('mail::button', ['url' => $url2])
Button 2 Text
@endcomponent
@component('mail::button', ['url' => $url3])
Button 3 Text
@endcomponent
谢谢,
{{ 配置('app.name') }}
@endcomponent
在构建电子邮件时,将对 SimpleMessage 方法的调用替换为对降价模板的引用,例如:
return (new MailMessage)
->subject($this->options['subject'])
->markdown('mail.invoice.paid', $this->options);
markdown 方法中的第二个参数是一个传递给您的视图的数组,通过它您可以包含您想要包含在电子邮件中的各种值,例如 contentParagraph1、问候语和称呼。
我有一个任务。在通知邮件文件中,我需要在 public 函数中添加一个按钮 toMail():
我做到了,但是按钮的背景色默认是黑色,我需要做成蓝色 .如何更改此功能中的颜色和按钮的代码?
这是代码示例:
public function toMail(): MailMessage
{
return (new MailMessage())
->action('Button name', rout('route.name'))
}
那么如何将背景颜色从默认黑色更改为我选择的按钮颜色(例如蓝色)?
谢谢。
SimpleMessage class 旨在创建具有一个号召性用语按钮的简单消息,您可以在 Illuminate/Notifications/Messages/SimpleMessage.php and the template for the SimpleMessage emails can be found in Illuminate/Notifications/resources/views/email.blade.php 中找到支持该功能的代码 — 请注意单个按钮。
您可以使用 Markdown 邮件通知功能创建更复杂的消息,这将允许您包含任意数量的按钮。您可以这样实现:
运行 生成新通知并传入 markdown 选项的命令,例如:php artisan make:notification InvoicePaid --markdown=mail.invoice.paid 打开新创建的模板,例如:views/mail/invoice/paid.blade.php 添加任意数量的按钮,例如:
@component('mail::message')
# Introduction
@component('mail::button', ['url' => $url1])
Button 1 Text
@endcomponent
@component('mail::button', ['url' => $url2])
Button 2 Text
@endcomponent
@component('mail::button', ['url' => $url3])
Button 3 Text
@endcomponent
谢谢,
{{ 配置('app.name') }}
@endcomponent
在构建电子邮件时,将对 SimpleMessage 方法的调用替换为对降价模板的引用,例如:
return (new MailMessage)
->subject($this->options['subject'])
->markdown('mail.invoice.paid', $this->options);
markdown 方法中的第二个参数是一个传递给您的视图的数组,通过它您可以包含您想要包含在电子邮件中的各种值,例如 contentParagraph1、问候语和称呼。