我正在使用Laravel通知发送电子邮件,但我想知道如何在文本行之间在电子邮件视图中显示表格。
我正在使用Laravel的默认视图,但我不知道如何传递表格。
这是我的toMail方法:
public function toMail($notifiable)
{
$message = new MailMessage();
$message->subject('Command confirmation n°'.$this->order->id)
->replyTo('noreply@example.com')
->line('Thanks to choose us!')
->line('Here the details of your order n°'.$this->order->id);
foreach($this->order->cart as $item){
// here the table
}
$message->line('To see your order click here');
$message->action('My orders', url('http://www.example.com/espace-perso/mes-commandes'))
return $message;
}
在 email.blade.php 视图中(默认的 Laravel 视图)我有以下代码:
{{-- Action Button --}}
@isset($actionText)
<?php
switch ($level) {
case 'success':
$color = 'green';
break;
case 'error':
$color = 'red';
break;
default:
$color = 'blue';
}
?>
@component('mail::button', ['url' => $actionUrl, 'color' => $color])
{{ $actionText }}
@endcomponent
@endisset
{{-- Outro Lines --}}
@foreach ($outroLines as $line)
{{ $line }}
@endforeach
如何将Markdown表格插入文本中,并将其放置在两行文字之间,就像操作按钮那样?