Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamic basic link in mail markdown with Laravel - not a button

I can generate a basic link like so:

This is an [example link](http://example.com/).

I can generate a button with a dynamic link like so:

@component('mail::button', ['url' => \URL::to('/subscriptions/'.$recipient->id.'/'.$recipient->email.'?action=subscribe')])
Sign Me Up
@endcomponent

But how do I generate a dynamic link, not button?

I tried:

[Safe Unsubscribe]( url('/subscriptions/'.$recipient->id.'/'.$recipient->email.'?action=unsubscribe') )

and

[Safe Unsubscribe]( \URL::to('/subscriptions/'.$recipient->id.'/'.$recipient->email.'?action=unsubscribe') )

but these output in a literal way:

url('/subscriptions/'.%24recipient-%3Eid.'/'.%24recipient-%3Eemail.'?action=subscribe%27)
like image 206
Dylan Glockler Avatar asked Nov 19 '25 12:11

Dylan Glockler


1 Answers

You are still in a blade template. So if you are not in a blade directive and you want to echo content, you have to use the curly brackets.

[Safe Unsubscribe]({{ url('/subscriptions/'.$recipient->id.'/'.$recipient->email.'?action=unsubscribe') }})
like image 162
Jerodev Avatar answered Nov 21 '25 05:11

Jerodev