Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

boyjarv's avatar

pass php variable to a string in MD

trying to pass a PHP variable to a string inside a MarkDown document:

@component('mail::button', ['url' => 'http://www.pubmic.co.uk/pubmic/venues/{{ $new_event->venue_id }}'])
Go to Venue
@endcomponent

but my link goes to here:

https://www.pubmic.co.uk/pubmic/venues/%3C?php%20echo%20e(%24new_event-%3Evenue_id);%20?%3E
0 likes
4 replies
Nakov's avatar

Try this maybe:

@component('mail::button', ['url' => 'http://www.pubmic.co.uk/pubmic/venues/' . {{ $new_event->venue_id }}])
MichalOravec's avatar
Level 75
@component('mail::button', ['url' => 'http://www.pubmic.co.uk/pubmic/venues/' . $new_event->venue_id])
Snapey's avatar

You are already in php context, no need to use blade echo syntax {{ .. }}

1 like

Please or to participate in this conversation.