nhayder's avatar
Level 13

markdown email button component use URL only, how to force named route instead

Hey,

The default markdown email has this component by default

@component('mail::button', ['url' => 'http://website.com'])
{{__('translation.activate')}}
@endcomponent

as per above its only accepting URL only, Is there is a way to force named route instead of URL

0 likes
5 replies
Snapey's avatar

you tried ?

@component('mail::button', ['url' => route('route.name')])
{{__('translation.activate')}}
@endcomponent
1 like
nhayder's avatar
Level 13

@Snapey i did actually try that but it didn't work then, maybe i mad some typical error or something,

Thanks anyway

1 like
nhayder's avatar
Level 13

@Snapey just checked the code but it not returning the correct data in the email.

@component('mail::button', ['url' => route('accountVerification'), $user->email, $user->email_verification_token])
{{__('translation.activate')}}
@endcomponent

is returning this code in the email

http://127.0.0.1:8000/en/myaccount/reVerifyEmail 

where my route requiers

Route::get('/accountVerification/{email}/{token}', 'UserController@accountVerification')->name('accountVerification');

any ideas ????

Snapey's avatar
Snapey
Best Answer
Level 122

Sorry, you did not say anything about additional parameters. These need to be inside the route function call

@component('mail::button', ['url' => route('accountVerification', [$user->email, $user->email_verification_token])
{{__('translation.activate')}}
@endcomponent
4 likes
nhayder's avatar
Level 13

@Snapey Yah i did't mention any additional parameters, Sorry about that, But your last post totally solved the problem, I have implements that change and tested it LOOKS GOOD.

Thank you

Please or to participate in this conversation.