I am trying to use @foreach
loop inside markdown template for sending mails.
While using HTML tags inside @foreach, it is not rendered properly
@component('mail::message')
These are the latest contents in our website
@foreach($results as $type => $result)
<h4>{{ $result['name'] }}</h4>
@endforeach
Thanks,<br>
{{ config('app.name') }}
@endcomponent
In the received mail, the <h4>
tag will be displayed as,
<h4>Article</h4>
Markdown is not getting processed when it's placed inside @foreach
loop. But it's processed when placed outside @foreach
loop.
Any help will be much appreciated. Thanks.
` isn't markdown (is it?). I think you need `#### {{ $result['name'] }} ####`
– apokryfos Jan 31 '18 at 08:41` tag is not converted to HTML tag inside the loop. Parsing the `@foreach` content is not properly processed.
– Ajith S Jan 31 '18 at 08:44` is an HTML tag not a markdown tag
– apokryfos Jan 31 '18 at 08:45` isn't a markup tag, and Laravel markdown templates work in both ways. But not inside the `@foreach` loop. Please refer: https://github.com/laravel/framework/issues/22290
– Ajith S Jan 31 '18 at 08:49