gabogabans
gabogabans

Reputation: 3553

laravel proper url in mail blade template

I'm trying to put a link to my web app in my blade mail template, however the url is showing like this : http://127.0.0.1:8000/.$code->discount->url. instead of a properly built, valid url.

This is how I'm doing it:

<a href="{{ url('.$code->discount->url.') }}">Enlace</a>

I also tried with:

<a href="{{ $code->discount->url }}">Enlace</a>

Second way only gave me a partial url (see bellow), not the full url host and path).

$code->discount->url is /promociones/hamburguesa-de-queso

Upvotes: 1

Views: 2716

Answers (1)

Rwd
Rwd

Reputation: 35190

Just remove the '. .' from around the $code->discount->url:

<a href="{{ url($code->discount->url) }}">Enlace</a>

The url() helper is PHP function so wrapping the $code->discount->url in quotes will cause php to see it as a literal string.

Upvotes: 3

Related Questions