Hello I apoligize if this has been asked already, I'm working on sending out a password reset email, and when I add the code below to the mail button and view the link in my email it comes across all messed up. However if i just output it OUTSIDE the button it comes thru fine. Any suggestions would be greatly appreciated. It's the {{$token}}
x-mail::message
Test
Hi , Lorem ipsum dolor sit amet, consectetur adipisicing elit. Adipisci natus porro harum! Sapiente deserunt omnis hic? Fugit atque ratione praesentium fuga excepturi nobis, quaerat error, dolores quam officiis molestiae corrupti.
<x-mail::button :url="'https://test.com/{{ $token }}'" color="primary">
Get Started
</x-mail::button>
Thanks,
Support Team
{{-- {{ config('app.name') }} --}}
</x-mail::message>
The issue is with the way the $token variable is being passed into the URL. Instead of using the {{ $token }} syntax inside the URL, it needs to be concatenated with the URL string. Here's an updated version of the code that should work:
@component('mail::message')
# Test
Hi,
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Adipisci natus porro harum! Sapiente deserunt omnis hic? Fugit atque ratione praesentium fuga excepturi nobis, quaerat error, dolores quam officiis molestiae corrupti.
@component('mail::button', ['url' => 'https://test.com/' . $token, 'color' => 'primary'])
Get Started
@endcomponent
Thanks,<br>
Support Team
{{-- {{ config('app.name') }} --}}
@endcomponent
This code uses the @component directive to create the button, and passes the URL as a string concatenated with the $token variable. This should result in a properly formatted URL in the email.