小编Sam*_*r B的帖子

Laravel 自定义邮件通知表

我正在使用 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;
    }
Run Code Online (Sandbox Code Playgroud)

在 email.blade.php 视图(默认 Laravel 视图)中,我有:

{{-- Action Button --}}
@isset($actionText)
<?php
    switch ($level) {
        case 'success':
            $color = 'green';
            break;
        case 'error':
            $color = 'red';
            break;
        default:
            $color …
Run Code Online (Sandbox Code Playgroud)

php laravel

4
推荐指数
1
解决办法
6888
查看次数

标签 统计

laravel ×1

php ×1