【发布时间】:2019-02-10 18:39:38
【问题描述】:
Laravel 5.6
我正在尝试通过电子邮件发送 Laravel 通知。我想让一些文本加粗,并放入换行符,而不是 line($text) 方法带来的全新段落。所以我在通知类中试过这个。我也尝试过使用\n 字符串换行。
return (new MailMessage)
->subject('Booking Confirmed - Please Read')
->greeting('Hello ' . $this->booking->user->first_name . ',')
->line('Thank you for booking. Here are your booking details:')
->line($this->booking->provider->providerType->name . '<br>' .
$date . '<br>' .
$this->booking->start_at . '<br>' .
$this->booking->address_1 . '<br>' .
$this->booking->address_2 . '<br>' .
$this->booking->address_3 . '<br>' .
$this->booking->city . '<br>' .
$this->booking->postcode . '<br>' .
'£' . $this->booking->price
)
->line('<strong>Need to cancel?</strong><br>' .
'Don\'t forget to contact the provider on the details above if you need to cancel or reschedule.
They won\'t mind, as long as you tell them.'
)
->line('<strong>Payment</strong><br>' .
'Pay the Service provider direct as you normally would. This keeps things simple and costs down.'
)
->line('<strong>FAQ\'s</strong><br>' .
'Please click here for more information'
)
->line('<strong>Don\'t forget to leave feedback after!</strong><br>' .
'Help build your relationship with your Service Providers by leaving feedback'
)
->line('We hope to see you again soon!')
我尝试过通过php artisan vendor:publish --tag=laravel-mail 命令发布和不发布刀片模板,然后毫无乐趣地将{{$line}} 更新为{!! $line !!}}。想不通。
【问题讨论】:
标签: php html laravel notifications