I have the following markdown mail in Laravel:
# Welcome to Offer Site
Thanks for listing your product, {{$user->name}}!
@component('mail::button', ['url' => 'https://www.example.com/product/view/{{$product->id}}', 'color'=> 'orange'])
View it here
@endcomponent
However, the rendered URL when the mail is sent is https://www.example.com/product/view/%3C?php%20echo%20e(%24product-%3Eid);%20?%3E
This is probably super simple but its hard to word... how do I go about making sure the variable is properly inserted into the URL bar as the parameter, this is in the build of the ProductAdded
mail:
return $this->markdown('emails.product-added-email');
And this is what I pass to ProductAdded
Mail:
\Mail::to($user)->send(new \App\Mail\ProductAdded($user, $product));
The variables work fine.
Any ideas?
You are already inside a php string, there is no need to use the blade brackets. You can just concatenate the string like so:
@component('mail::button', ['url' => 'https://www.example.com/product/view/' . $product->id, 'color' => 'orange'])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With